-
Notifications
You must be signed in to change notification settings - Fork 5
/
example-mac-configurations.py
executable file
·284 lines (245 loc) · 5.88 KB
/
example-mac-configurations.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
import usb_hid
import time
import random
from abstract_classes import AbstractConfiguration, AbstractMacro
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode
keyboard = Keyboard(usb_hid.devices)
layout = KeyboardLayoutUS(keyboard)
## CONFIGURATIONS ##
class Terminal(AbstractConfiguration):
def getName():
return 'Terminal'
def getColor():
return (0, 255, 0)
def getMacros():
return [
Ls,
Pwd,
Home
]
class GoogleMeet(AbstractConfiguration):
def getName():
return 'Google Meet'
def getColor():
return (255, 128, 0)
def getMacros():
return [
ToggleMicrophone,
ToggleWebcam
]
class OBS(AbstractConfiguration):
def getName():
return 'OBS'
def getColor():
return (0, 0, 255)
def getMacros():
return [
SelectScene1,
SelectScene2,
SelectScene3,
MuteOn,
MuteOff
]
class Obsidian(AbstractConfiguration):
def getName():
return 'Obsidian'
def getColor():
return (51, 51, 255)
def getMacros():
return [
AddNewLog
]
class Git(AbstractConfiguration):
def getName():
return 'GIT'
def getColor():
return (247, 78, 39)
def getMacros():
return [
MergeDevelop,
MergeMaster,
GitPush
]
class RandomEstimation(AbstractConfiguration):
def getName():
return 'Random Esteem'
def getColor():
return (255, 0, 0)
def getMacros():
return [
OneWeekEsteem,
OneMonthEsteem,
SixMonthsEsteem
]
class PhpStorm(AbstractConfiguration):
def getName():
return 'PHPStorm'
def getColor():
return (232, 49, 123)
def getMacros():
return [
OpenInTerminal,
Rename,
ComposerAutoload,
ListenForDebug,
StepOver,
StepInto,
StepOut,
NextBreakpoint
]
## COMMANDS ##
class OpenInTerminal(AbstractMacro):
def getMacroName():
return 'Open in terminal'
def getMacro():
keyboard.send(Keycode.ALT, Keycode.T)
class Rename(AbstractMacro):
def getMacroName():
return 'Rename'
def getMacro():
keyboard.send(Keycode.SHIFT, Keycode.F6)
class ListenForDebug(AbstractMacro):
def getMacroName():
return 'Listen for debug'
def getMacro():
keyboard.send(Keycode.ALT, Keycode.D)
class StepOver(AbstractMacro):
def getMacroName():
return 'Step over'
def getMacro():
keyboard.send(Keycode.F8)
class StepInto(AbstractMacro):
def getMacroName():
return 'Step into'
def getMacro():
keyboard.send(Keycode.F7)
class StepOut(AbstractMacro):
def getMacroName():
return 'Step out'
def getMacro():
keyboard.send(Keycode.SHIFT, Keycode.F8)
class NextBreakpoint(AbstractMacro):
def getMacroName():
return 'Next breakpoint'
def getMacro():
keyboard.send(Keycode.ALT, Keycode.COMMAND, Keycode.R)
class ComposerAutoload(AbstractMacro):
def getMacroName():
return 'Composer autoload'
def getMacro():
layout.write('composer dump')
keyboard.send(Keycode.KEYPAD_MINUS)
layout.write('autoload')
keyboard.send(Keycode.ENTER)
class OneWeekEsteem(AbstractMacro):
def getMacroName():
return '< 1 week'
def getMacro():
layout.write(str(random.randint(1, 5)))
keyboard.send(Keycode.ENTER)
class OneMonthEsteem(AbstractMacro):
def getMacroName():
return '< 1 month'
def getMacro():
layout.write(str(random.randint(5, 20)))
keyboard.send(Keycode.ENTER)
class SixMonthsEsteem(AbstractMacro):
def getMacroName():
return '< 6 months'
def getMacro():
layout.write(str(random.randint(20, 120)))
keyboard.send(Keycode.ENTER)
class Ls(AbstractMacro):
def getMacroName():
return 'ls -al'
def getMacro():
layout.write("ls ")
keyboard.send(Keycode.KEYPAD_MINUS)
layout.write("al")
keyboard.send(Keycode.ENTER)
class Pwd(AbstractMacro):
def getMacroName():
return 'pwd'
def getMacro():
layout.write("pwd")
keyboard.send(Keycode.ENTER)
class Home(AbstractMacro):
def getMacroName():
return 'Home'
def getMacro():
layout.write("cd ")
keyboard.send(Keycode.ENTER)
class ToggleMicrophone(AbstractMacro):
def getMacroName():
return 'Toggle Microphone'
def getMacro():
keyboard.send(Keycode.COMMAND, Keycode.D)
class ToggleWebcam(AbstractMacro):
def getMacroName():
return 'Toggle Webcam'
def getMacro():
keyboard.send(Keycode.COMMAND, Keycode.E)
class SelectScene1(AbstractMacro):
def getMacroName():
return 'Scene 1'
def getMacro():
keyboard.send(Keycode.LEFT_ALT, Keycode.ONE)
class SelectScene2(AbstractMacro):
def getMacroName():
return 'Scene 2'
def getMacro():
keyboard.send(Keycode.LEFT_ALT, Keycode.TWO)
class SelectScene3(AbstractMacro):
def getMacroName():
return 'Scene 3'
def getMacro():
keyboard.send(Keycode.LEFT_ALT, Keycode.THREE)
class MuteOn(AbstractMacro):
def getMacroName():
return 'Mute'
def getMacro():
keyboard.send(Keycode.LEFT_ALT, Keycode.FOUR)
class MuteOff(AbstractMacro):
def getMacroName():
return 'Unmute'
def getMacro():
keyboard.send(Keycode.LEFT_ALT, Keycode.FIVE)
class AddNewLog(AbstractMacro):
def getMacroName():
return 'New Log'
def getMacro():
keyboard.send(Keycode.COMMAND, Keycode.P)
layout.write("Insert template")
time.sleep(0.1)
keyboard.send(Keycode.ENTER)
layout.write("New log")
time.sleep(0.1)
keyboard.send(Keycode.ENTER)
class MergeDevelop(AbstractMacro):
def getMacroName():
return "Merge develop into master"
def getMacro():
layout.write("git checkout master")
keyboard.send(Keycode.ENTER)
time.sleep(0.5)
layout.write("git merge develop")
keyboard.send(Keycode.ENTER)
class MergeMaster(AbstractMacro):
def getMacroName():
return "Merge master into develop"
def getMacro():
layout.write("git checkout develop")
keyboard.send(Keycode.ENTER)
time.sleep(0.5)
layout.write("git merge master")
keyboard.send(Keycode.ENTER)
class GitPush(AbstractMacro):
def getMacroName():
return "Push"
def getMacro():
layout.write("git push")
keyboard.send(Keycode.ENTER)
# Map your configurations inside this array
configurations_map = [Terminal, GoogleMeet, Obsidian, RandomEstimation, PhpStorm, Git ]