hammerspoon_hotkey_hello_world.lua
· 237 B · Lua
Eredeti
-- 快速鍵:command + alt + ctrl + W
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "W", function()
-- 顯示通知:「Hammerspoon - Hello World」
hs.notify.new({title = "Hammerspoon", informativeText = "Hello World"}):send()
end)
| 1 | -- 快速鍵:command + alt + ctrl + W |
| 2 | hs.hotkey.bind({"cmd", "alt", "ctrl"}, "W", function() |
| 3 | -- 顯示通知:「Hammerspoon - Hello World」 |
| 4 | hs.notify.new({title = "Hammerspoon", informativeText = "Hello World"}):send() |
| 5 | end) |
| 6 |
hammerspoon_move_mouse_to_next_screen.lua
· 297 B · Lua
Eredeti
-- 快速鍵:ctrl + alt + cmd + M 移動滑鼠到下一個螢幕中心
hs.hotkey.bind({"ctrl", "alt", "cmd"}, "M", function()
local nextScreen = hs.mouse.getCurrentScreen():next()
local center = hs.geometry.rectMidPoint(nextScreen:fullFrame())
hs.mouse.absolutePosition(center)
end)
| 1 | -- 快速鍵:ctrl + alt + cmd + M 移動滑鼠到下一個螢幕中心 |
| 2 | hs.hotkey.bind({"ctrl", "alt", "cmd"}, "M", function() |
| 3 | local nextScreen = hs.mouse.getCurrentScreen():next() |
| 4 | local center = hs.geometry.rectMidPoint(nextScreen:fullFrame()) |
| 5 | hs.mouse.absolutePosition(center) |
| 6 | end) |
| 7 |
hammerspoon_toggle_aclock.lua
· 332 B · Lua
Eredeti
-- 載入 AClock 擴充套件
hs.loadSpoon("AClock")
-- 檢查 AClock 是否載入成功
if spoon.AClock then
-- 快速鍵:command + alt + ctrl + C 切換 AClock 顯示狀態
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "C", function()
spoon.AClock:toggleShow()
end)
else
hs.alert.show("AClock not loaded")
end
| 1 | -- 載入 AClock 擴充套件 |
| 2 | hs.loadSpoon("AClock") |
| 3 | |
| 4 | -- 檢查 AClock 是否載入成功 |
| 5 | if spoon.AClock then |
| 6 | -- 快速鍵:command + alt + ctrl + C 切換 AClock 顯示狀態 |
| 7 | hs.hotkey.bind({"cmd", "alt", "ctrl"}, "C", function() |
| 8 | spoon.AClock:toggleShow() |
| 9 | end) |
| 10 | else |
| 11 | hs.alert.show("AClock not loaded") |
| 12 | end |
| 13 |