Zuletzt aktiv 1 year ago

Hammerspoon 配置範例,包括快速鍵與功能實現,適合初學者學習與擴展。

timmy hat die Gist bearbeitet 1 year ago. Zu Änderung gehen

1 file changed, 5 insertions

hammerspoon_reload_config.lua(Datei erstellt)

@@ -0,0 +1,5 @@
1 + -- 快速鍵:cmd + alt + ctrl + R,重新載入 Hammerspoon 設定
2 + hs.hotkey.bind({"cmd", "alt", "ctrl"}, "R", hs.reload)
3 +
4 + -- 顯示「Config loaded」提示
5 + hs.alert.show("Config loaded")

timmy hat die Gist bearbeitet 1 year ago. Zu Änderung gehen

1 file changed, 1 insertion, 1 deletion

hammerspoon_move_mouse_to_next_screen.lua

@@ -1,4 +1,4 @@
1 - -- 快速鍵:ctrl + alt + cmd + M 移動鼠標到下一個螢幕中心
1 + -- 快速鍵:ctrl + alt + cmd + M 移動滑鼠到下一個螢幕中心
2 2 hs.hotkey.bind({"ctrl", "alt", "cmd"}, "M", function()
3 3 local nextScreen = hs.mouse.getCurrentScreen():next()
4 4 local center = hs.geometry.rectMidPoint(nextScreen:fullFrame())

timmy hat die Gist bearbeitet 1 year ago. Zu Änderung gehen

1 file changed, 6 insertions

hammerspoon_move_mouse_to_next_screen.lua(Datei erstellt)

@@ -0,0 +1,6 @@
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)

timmy hat die Gist bearbeitet 1 year ago. Zu Änderung gehen

1 file changed, 12 insertions

hammerspoon_toggle_aclock.lua(Datei erstellt)

@@ -0,0 +1,12 @@
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

timmy hat die Gist bearbeitet 1 year ago. Zu Änderung gehen

1 file changed, 0 insertions, 0 deletions

gistfile1.txt umbenannt zu hammerspoon_hotkey_hello_world.lua

Datei ohne Änderung umbenannt

timmy hat die Gist bearbeitet 1 year ago. Zu Änderung gehen

1 file changed, 5 insertions

gistfile1.txt(Datei erstellt)

@@ -0,0 +1,5 @@
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)
Neuer Älter