-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHotkeyMappings.lua
247 lines (244 loc) · 6.38 KB
/
HotkeyMappings.lua
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
CmdAltCtrl = { "cmd", "alt", "ctrl" }
CmdAltCtrlShift = { "cmd", "alt", "ctrl", "shift" }
function BindResizers()
for _, numberKey in pairs({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }) do
local resizer = {
name = "Resize " .. numberKey .. "0%",
modifier = CmdAltCtrl,
key = numberKey,
callback = function() Resize(numberKey) end
}
table.insert(HotkeyMappings, resizer)
end
end
function BindHotkeys()
for _, mapping in pairs(HotkeyMappings) do
if mapping.name == "Open Clipboard History" then
hs.dockicon.hide() -- must call this for the chooser to display over full-screen windows
TextClipboardHistory:bindHotkeys({ toggle_clipboard = { mapping.modifier, mapping.key } })
hs.dockicon.show()
elseif mapping.key ~= nil then
hs.hotkey.bind(mapping.modifier, mapping.key, mapping.callback)
end
end
end
HotkeyMappings = {
{ name = "Reload Hammerspon Config", modifier = CmdAltCtrl, key = "R", callback = function() hs.reload() end },
{ name = "Display Window Grid", modifier = CmdAltCtrl, key = "G", callback = function() hs.grid.show() end },
{
name = "Split Window Left",
modifier = CmdAltCtrl,
key = "[",
callback = function() SplitWindow(hs.window.focusedWindow(), "left") end
},
{
name = "Split Window Right",
modifier = CmdAltCtrl,
key = "]",
callback = function() SplitWindow(hs.window.focusedWindow(), "right") end
},
{
name = "Split Window Up",
modifier = CmdAltCtrl,
key = "=",
callback = function() SplitWindow(hs.window.focusedWindow(), "up") end
},
{
name = "Split Window Down",
modifier = CmdAltCtrl,
key = "'",
callback = function() SplitWindow(hs.window.focusedWindow(), "down") end
},
{
-- needs work, also, I don't use very often
name = "Split Chrome and VSCode",
modifier = CmdAltCtrl,
key = ",",
callback = function()
local code = hs.window("VS Code")
local chrome = hs.window("Chrome")
SplitWindow(code, "left")
SplitWindow(chrome, "right")
print(code, chrome)
end
},
{
name = "Send Window to Left Monitor",
modifier = CmdAltCtrl,
key = "left",
callback = function()
local window = hs.window.focusedWindow()
window:moveOneScreenWest(false, true)
end
},
{
name = "Send Window to Right Monitor",
modifier = CmdAltCtrl,
key = "right",
callback = function()
local window = hs.window.focusedWindow()
window:moveOneScreenEast(false, true)
end
},
{
name = "Maximize Window",
modifier = CmdAltCtrl,
key = "space",
callback = function()
local window = hs.window.focusedWindow()
window:maximize()
end
},
{
name = "Send Window to Left Adjacent Space",
modifier = CmdAltCtrlShift,
key = "L",
callback = function() SendToSpace("left") end
},
{
name = "Send Window to Right Adjacent Space",
modifier = CmdAltCtrlShift,
key = "R",
callback = function() SendToSpace("right") end
},
{
name = "Open iTerm2",
modifier = CmdAltCtrl,
key = "\\",
callback = function() LaunchApp({ appName = "iTerm", action = "New Window" }) end
},
{
name = "Open New Stickies Note",
modifier = CmdAltCtrl,
key = "S",
callback = function()
LaunchApp(
{
appName = "Stickies",
action = "New Note",
opts = {
{ "Color", RandomStickyColor() },
{ "Edit", "Spelling and Grammar", "Check Spelling While Typing" },
{ "Edit", "Spelling and Grammar", "Correct Spelling Automatically" }
}
})
end
},
{
name = "Open New Chrome Window",
modifier = CmdAltCtrl,
key = "C",
callback = function() LaunchApp({ appName = "Google Chrome", action = "New Window" }) end
},
{
name = "Open New Chrome Window Personal Profile",
modifier = CmdAltCtrlShift,
key = "C",
callback = function() LaunchApp({ appName = "Google Chrome", action = { "Profiles", "PJ" } }) end
},
{
name = "Split Chrome Tab With Window",
modifier = CmdAltCtrl,
key = ".",
callback = function() ChromeSplitTab() end
},
{
name = "Paste Zoom Link",
modifier = CmdAltCtrl,
key = "Z",
callback = function() hs.eventtap.keyStrokes(ZOOM_LINK) end
},
{
name = "Paste user ID",
modifier = CmdAltCtrl,
key = "N",
callback = function() hs.eventtap.keyStrokes(USER_ID) end
},
{
name = "Convert Epoch Timestamp",
modifier = CmdAltCtrl,
key = "T",
callback = function()
local timestamp = GrabSelectedText()
ConvertEpochTimestamp(timestamp)
end
},
{
name = "Lookup Etherum Address or Txn",
modifier = CmdAltCtrl,
key = "E",
callback = function()
local hash = GrabSelectedText()
EtherscanLookup(hash);
end
},
{
name = "mocKinGTypER",
modifier = CmdAltCtrl,
key = "P",
callback = function() MockingTyper() end
},
{
name = "Open Clipboard History",
modifier = CmdAltCtrl,
key = "V"
},
{
name = "Clear Last Clipboard Item",
modifier = CmdAltCtrl,
key = "forwarddelete",
callback = function() TextClipboardHistory:clearLastItem() end
},
{
name = "Hotkey Help Menu",
modifier = CmdAltCtrl,
key = "H",
callback = function() HotkeyHelpMenu() end
},
{
name = "Flip Table",
modifier = CmdAltCtrl,
key = "pageup",
callback = function() hs.eventtap.keyStrokes("(╯°□°)╯︵ ┻━┻") end
},
{
name = "Unflip Table",
modifier = CmdAltCtrl,
key = "pagedown",
callback = function() hs.eventtap.keyStrokes("┬─┬ノ( º _ ºノ)") end
},
{
name = "Shrug",
modifier = CmdAltCtrlShift,
key = "S",
callback = function() hs.eventtap.keyStrokes("¯\\__(ツ)__/¯") end
},
{
name = "Set Brightness to 100%",
modifier = CmdAltCtrl,
key = "0",
callback = function() hs.brightness.set(100) end
},
{
name = "Lowercase Selected Text",
modifier = CmdAltCtrl,
key = "down",
callback = function()
hs.eventtap.keyStrokes(string.lower(GrabSelectedText()))
end
},
{
name = "Uppercase Selected Text",
modifier = CmdAltCtrl,
key = "up",
callback = function()
hs.eventtap.keyStrokes(string.upper(GrabSelectedText()))
end
},
{
name = "Set Grid",
modifier = nil,
key = nil,
callback = function() PromptSetGrid() end
}
}