-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathkeybindings_config.lua
More file actions
387 lines (370 loc) · 12.2 KB
/
keybindings_config.lua
File metadata and controls
387 lines (370 loc) · 12.2 KB
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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
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",
},
keep_awake = {
prefix = { "Option" },
key = "A",
message = "Toggle Prevent Sleep",
-- 是否默认开启防休眠状态
enabled = false,
-- 是否显示菜单栏图标
show_menubar = true,
-- true 时同时阻止屏幕休眠; false 时仅阻止系统休眠, 屏幕仍可熄灭
keep_display_awake = false,
},
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.tencent.inputmethod.wetype"
-- 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"] = pinyin,
["com.apple.finder"] = pinyin,
["com.apple.Spotlight"] = pinyin,
["org.alacritty"] = pinyin,
["dev.warp.Warp-Stable"] = pinyin,
["com.google.Chrome"] = pinyin,
["org.virtualbox.app.VirtualBox"] = pinyin,
["com.postmanlabs.mac"] = pinyin,
["com.tencent.xinWeChat"] = pinyin,
["com.apple.mail"] = pinyin,
["com.microsoft.Excel"] = pinyin,
["mac.im.qihoo.net"] = pinyin,
["ynote-desktop"] = pinyin,
["md.obsidian"] = pinyin,
["com.microsoft.VSCode"] = pinyin,
["com.google.antigravity"] = pinyin,
["com.todesktop.230313mzl4w4u92"] = 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 = "Ghostty", bundleId = "com.mitchellh.ghostty" },
{ prefix = { "Option" }, key = "C", message = "Chrome", bundleId = "com.google.Chrome" },
{ prefix = { "Option" }, key = "N", message = "Antigravity", bundleId = "com.google.antigravity" },
{ prefix = { "Option" }, key = "D", message = "WPS", bundleId = "com.kingsoft.wpsoffice.mac" },
{ 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 = "K", message = "Cursor", bundleId = "com.todesktop.230313mzl4w4u92" },
{ 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",
},
}
-- 剪贴板历史
_M.clipboard = {
enabled = true,
-- 是否显示菜单栏图标
show_menubar = true,
-- 历史记录保留条数
history_size = 80,
-- 菜单栏主菜单里直接显示多少条最近历史,也可在菜单栏里运行时修改
menu_history_size = 12,
-- 超过该字节数的文本不纳入历史,避免把超大块内容塞进 hs.settings
max_item_length = 30000,
-- 是否同时记录图片剪贴板历史
capture_images = true,
-- 图片历史缓存目录,支持 ~/ 开头、绝对路径,或相对 hs.configdir 的路径
-- 留空时自动使用 ~/Library/Caches/<当前 Hammerspoon bundle id>/clipboard_center_images
image_cache_dir = "",
-- 菜单栏历史项中图片缩略图边长
image_menu_thumbnail_size = 80,
-- chooser 打开时是否显示预览面板,兼容旧键名 image_preview_enabled
preview_enabled = true,
-- 预览面板宽高,兼容旧键名 image_preview_width / image_preview_height
preview_width = 420,
preview_height = 320,
-- 选择 chooser 行数
chooser_rows = 12,
-- chooser 宽度,单位是屏幕宽度的百分比
chooser_width = 40,
-- NOTE: message 的值建议保持英文,避免快捷键面板错位
prefix = { "Option", "Shift" },
key = "C",
message = "Clipboard Center",
}
-- Bing Daily Picture 壁纸
_M.bing_daily_wallpaper = {
enabled = true,
-- 定时检查 Bing 当日壁纸的周期,单位秒
refresh_interval_seconds = 60 * 60,
-- 请求壁纸尺寸
picture_width = 3072,
picture_height = 1920,
-- 拉取最近多少天的 Bing 壁纸元数据
-- 为 1 时始终使用当天壁纸;大于 1 时会从最近几天里随机选一张
history_count = 1,
-- 元数据接口和图片下载的基础地址
metadata_base_url = "https://cn.bing.com",
image_base_url = "https://www.bing.com",
-- 缓存目录,支持 ~/ 开头、绝对路径,或相对 hs.configdir 的路径
-- 留空时自动使用 ~/Library/Caches/<当前 Hammerspoon bundle id>/bing_daily_wallpaper
cache_dir = "",
}
-- 强制休息提醒
-- 说明:
-- 1. 锁屏期间不计入工作时长
-- 2. 解锁屏幕后会重新开始新一轮工作计时
_M.break_reminder = {
enabled = true,
-- 是否显示菜单栏图标, 可通过菜单直接调整提醒配置
show_menubar = true,
-- 菜单栏图标皮肤: coffee / hourglass / bars
menubar_skin = "coffee",
-- 休息结束后如何开始下一轮工作计时
-- auto: 休息结束立即开始
-- on_input: 等待首次键盘或鼠标输入后开始
start_next_cycle = "auto",
-- 可选: "soft" 或 "hard"
-- soft: 显示半透明遮罩但不抢占鼠标和键盘
-- hard: 显示遮罩并明确拦截鼠标和键盘
mode = "hard",
-- 遮罩透明度, 范围 0~1
-- 默认值: soft=0.32, hard=0.96
overlay_opacity = 0.96,
-- true 时仅显示简洁图标,不显示倒计时和说明文字
minimal_display = true,
-- 每日专注目标, 达到后计入连续达标天数
focus_goal_minutes = 120,
-- 每日完成多少次休息算达到休息目标; 0 表示禁用
break_goal_count = 4,
-- 当日跳过休息达到该次数后, 自动切换为硬性提醒; 0 表示禁用
strict_mode_after_skips = 2,
-- 每跳过一次休息, 为后续每次休息额外增加的惩罚秒数
rest_penalty_seconds_per_skip = 30,
-- 跳过惩罚累计上限, 单位为秒
max_rest_penalty_seconds = 300,
-- 友好提示文案模板
-- 可用占位符: {{remaining}} {{remaining_seconds}} {{remaining_mmss}} {{rest}} {{rest_seconds}} {{rest_mmss}}
friendly_reminder_message = "还有 {{remaining}} 开始休息",
-- 友好提示默认停留秒数, 0 表示不自动关闭, 只允许手动点 x 关闭
friendly_reminder_duration_seconds = 10,
-- 距离休息还有多少秒时做一次友好提示, 0 为禁用
friendly_reminder_seconds = 120,
-- 单位: 分钟
work_minutes = 28,
-- 单位: 秒
rest_seconds = 120,
}
return _M