-
Notifications
You must be signed in to change notification settings - Fork 3
/
keybindings_config.lua
275 lines (261 loc) · 8.61 KB
/
keybindings_config.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
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
local _M = {}
_M.name = "keybindings_config"
_M.description = "快捷键配置"
-- 快捷键备忘单展示
_M.keybindings_cheatsheet = {
prefix = {
"Option"
},
key = "/",
message = "Toggle Keybindings Cheatsheet",
description = "⌥/: Toggle Keybindings Cheatsheet"
}
-- 系统管理
_M.system = {
lock_screen = {
prefix = {"Option"},
key = "Q",
message = "Lock Screen"
},
screen_saver = {
prefix = {"Option"},
key = "S",
message = "Start Screensaver"
},
restart = {
prefix = {"Ctrl", "Option", "Command", "Shift"},
key = "R",
message = "Restart Computer"
},
shutdown = {
prefix = {"Ctrl", "Option", "Command", "Shift"},
key = "S",
message = "Shutdown Computer"
}
}
-- 调用默认浏览器快速打开URL
_M.websites = {
{
prefix = {"Option"},
key = "8",
message = "github.com",
target = "https://github.com/windvalley"
},
{
prefix = {"Option"},
key = "9",
message = "google.com",
target = "https://www.google.com"
},
{
prefix = {"Option"},
key = "7",
message = "bing.com",
target = "https://www.bing.com"
}
}
-- 简体拼音
local pinyin = "com.apple.inputmethod.SCIM.ITABC"
-- ABC
local abc = "com.apple.keylayout.ABC"
-- 手动切换到目标输入法
_M.manual_input_methods = {
-- NOTE: message的值不能是中文, 会导致快捷键列表面板显示错位.
{prefix = {"Option"}, key = "1", input_method = abc, message = "ABC"},
{prefix = {"Option"}, key = "2", input_method = pinyin, message = "Pinyin"}
}
-- 自动切换App所对应的输入法, 格式: 应用的bundleID = 输入法简称
-- NOTE: 获取某个App的bundleId的方法举例: osascript -e 'id of app "chrome"'
_M.auto_input_methods = {
["org.hammerspoon.Hammerspoon"] = abc,
["com.apple.finder"] = abc,
["com.apple.Spotlight"] = abc,
["org.alacritty"] = abc,
["md.obsidian"] = abc,
["com.google.Chrome"] = abc,
["com.microsoft.VSCode"] = abc,
["org.virtualbox.app.VirtualBox"] = abc,
["com.postmanlabs.mac"] = abc,
["com.tencent.xinWeChat"] = pinyin,
["com.apple.mail"] = pinyin,
["com.microsoft.Excel"] = pinyin,
["mac.im.qihoo.net"] = pinyin,
["ynote-desktop"] = pinyin
}
-- App启动或隐藏
-- NOTE: 获取某个App的bundleId的方法举例: osascript -e 'id of app "chrome"'
_M.apps = {
{prefix = {"Option"}, key = "H", message = "Hammerspoon Console", bundleId = "org.hammerspoon.Hammerspoon"},
{prefix = {"Option"}, key = "F", message = "Finder", bundleId = "com.apple.finder"},
{prefix = {"Option"}, key = "I", message = "Alacritty", bundleId = "org.alacritty"},
{prefix = {"Option"}, key = "C", message = "Chrome", bundleId = "com.google.Chrome"},
{prefix = {"Option"}, key = "N", message = "Note", bundleId = "ynote-desktop"},
{prefix = {"Option"}, key = "D", message = "Draw.io", bundleId = "com.jgraph.drawio.desktop"},
{prefix = {"Option"}, key = "K", message = "Freeplane", bundleId = "org.freeplane.launcher"},
{prefix = {"Option"}, key = "O", message = "Obsidian", bundleId = "md.obsidian"},
{prefix = {"Option"}, key = "M", message = "Mail", bundleId = "com.apple.mail"},
{prefix = {"Option"}, key = "P", message = "Postman", bundleId = "com.postmanlabs.mac"},
{prefix = {"Option"}, key = "E", message = "Excel", bundleId = "com.microsoft.Excel"},
{prefix = {"Option"}, key = "V", message = "VSCode", bundleId = "com.microsoft.VSCode"},
{prefix = {"Option"}, key = "J", message = "Tuitui", bundleId = "mac.im.qihoo.net"},
{prefix = {"Option"}, key = "W", message = "WeChat", bundleId = "com.tencent.xinWeChat"}
}
-- 窗口管理: 改变窗口位置
_M.window_position = {
-- **************************************
-- 居中
center = {prefix = {"Ctrl", "Option"}, key = "C", message = "Center Window"},
-- **************************************
-- 左半屏
left = {prefix = {"Ctrl", "Option"}, key = "H", message = "Left Half of Screen"},
-- 右半屏
right = {prefix = {"Ctrl", "Option"}, key = "L", message = "Right Half of Screen"},
-- 上半屏
up = {prefix = {"Ctrl", "Option"}, key = "K", message = "Up Half of Screen"},
-- 下半屏
down = {prefix = {"Ctrl", "Option"}, key = "J", message = "Down Half of Screen"},
-- **************************************
-- 左上角
top_left = {prefix = {"Ctrl", "Option"}, key = "Y", message = "Top Left Corner"},
-- 右上角
top_right = {prefix = {"Ctrl", "Option"}, key = "O", message = "Top Right Corner"},
-- 左下角
bottom_left = {prefix = {"Ctrl", "Option"}, key = "U", message = "Bottom Left Corner"},
-- 右下角
bottom_right = {prefix = {"Ctrl", "Option"}, key = "I", message = "Bottom Right Corner"},
-- **********************************
-- 左 1/3(横屏)或上 1/3(竖屏)
left_1_3 = {
prefix = {"Ctrl", "Option"},
key = "Q",
message = "Left or Top 1/3"
},
-- 右 1/3(横屏)或下 1/3(竖屏)
right_1_3 = {
prefix = {"Ctrl", "Option"},
key = "W",
message = "Right or Bottom 1/3"
},
-- 左 2/3(横屏)或上 2/3(竖屏)
left_2_3 = {
prefix = {"Ctrl", "Option"},
key = "E",
message = "Left or Top 2/3"
},
-- 右 2/3(横屏)或下 2/3(竖屏)
right_2_3 = {
prefix = {"Ctrl", "Option"},
key = "R",
message = "Right or Bottom 2/3"
}
}
-- 窗口操作: 移动窗口.
_M.window_movement = {
-- 向上移动窗口
to_up = {
prefix = {"Ctrl", "Option", "Command"},
key = "K",
message = "Move Upward"
},
-- 向下移动窗口
to_down = {
prefix = {"Ctrl", "Option", "Command"},
key = "J",
message = "Move Downward"
},
-- 向左移动窗口
to_left = {
prefix = {"Ctrl", "Option", "Command"},
key = "H",
message = "Move Leftward"
},
-- 向右移动窗口
to_right = {
prefix = {"Ctrl", "Option", "Command"},
key = "L",
message = "Move Rightward"
}
}
-- 窗口操作: 改变窗口大小
_M.window_resize = {
-- 最大化
max = {prefix = {"Ctrl", "Option"}, key = "M", message = "Max Window"},
-- 等比例放大窗口
stretch = {prefix = {"Ctrl", "Option"}, key = "=", message = "Stretch Outward"},
-- 等比例缩小窗口
shrink = {prefix = {"Ctrl", "Option"}, key = "-", message = "Shrink Inward"},
-- 底边向上伸展窗口
stretch_up = {
prefix = {"Ctrl", "Option", "Command", "Shift"},
key = "K",
message = "Bottom Side Stretch Upward"
},
-- 底边向下伸展窗口
stretch_down = {
prefix = {"Ctrl", "Option", "Command", "Shift"},
key = "J",
message = "Bottom Side Stretch Downward"
},
-- 右边向左伸展窗口
stretch_left = {
prefix = {"Ctrl", "Option", "Command", "Shift"},
key = "H",
message = "Right Side Stretch Leftward"
},
-- 右边向右伸展窗口
stretch_right = {
prefix = {"Ctrl", "Option", "Command", "Shift"},
key = "L",
message = "Right Side Stretch Rightward"
}
}
-- 窗口管理: 批量处理
_M.window_batch = {
-- 最小化所有窗口.
minimize_all_windows = {
prefix = {"Ctrl", "Option", "Command"},
key = "M",
message = "Minimize All Windows"
},
-- 恢复所有最小化的窗口.
un_minimize_all_windows = {
prefix = {"Ctrl", "Option", "Command"},
key = "U",
message = "Unminimize All Windows"
},
-- 关闭所有窗口.
close_all_windows = {
prefix = {"Ctrl", "Option", "Command"},
key = "Q",
message = "Close All Windows"
}
}
-- 窗口操作: 移动到上下左右或下一个显示器
_M.window_monitor = {
to_above_screen = {
prefix = {"Ctrl", "Option"},
key = "up",
message = "Move to Above Monitor"
},
to_below_screen = {
prefix = {"Ctrl", "Option"},
key = "down",
message = "Move to Below Monitor"
},
to_left_screen = {
prefix = {"Ctrl", "Option"},
key = "left",
message = "Move to Left Monitor"
},
to_right_screen = {
prefix = {"Ctrl", "Option"},
key = "right",
message = "Move to Right Monitor"
},
to_next_screen = {
prefix = {"Ctrl", "Option"},
key = "space", -- 扩展显示器比较少的情况只用这个就可以.
message = "Move to Next Monitor"
}
}
return _M