-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsystem_manage.lua
52 lines (44 loc) · 996 Bytes
/
system_manage.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
local _M = {}
_M.name = "system_manage"
_M.description = "系统管理, 比如: 锁屏, 启动屏保, 重启等"
local system = require("keybindings_config").system
local log = hs.logger.new("system")
-- 锁屏.
hs.hotkey.bind(
system.lock_screen.prefix,
system.lock_screen.key,
system.lock_screen.message,
function()
log.d("lock screen")
hs.caffeinate.lockScreen()
end
)
-- 启动屏保.
hs.hotkey.bind(
system.screen_saver.prefix,
system.screen_saver.key,
system.screen_saver.message,
function()
log.d("start screensaver")
hs.caffeinate.startScreensaver()
end
)
-- 重启.
hs.hotkey.bind(
system.restart.prefix,
system.restart.key,
system.restart.message,
function()
hs.caffeinate.restartSystem()
end
)
-- 关机.
hs.hotkey.bind(
system.shutdown.prefix,
system.shutdown.key,
system.shutdown.message,
function()
hs.caffeinate.shutdownSystem()
end
)
return _M