Hammerspoon
1
-- Call Hammerspoon functions from AppleScript
2
​
3
-- First activate applescript support:
4
hs.allowAppleScript(true)
5
​
6
-- Then you can call functions from your lua code like this:
7
tell application "Hammerspoon"
8
execute lua code "showClipBoardContent()"
9
end tell
10
​
11
-- In the above case it would call showClipBoardContent() function
Copied!
1
-- Bind function to hotkey
2
hs.hotkey.bind("ctrl", "return", function()
3
hs.notify.new({title="Hammerspoon", informativeText="Hello World"}):send()
4
end)
Copied!
1
-- URL handler alert
2
​
3
hs.urlevent.bind("someAlert", function(eventName, params)
4
hs.alert.show("Hey there alert")
5
end)
6
​
7
-- After having this line in init.lua
8
-- you can then call it from the shell like so
9
open -g hammerspoon://someAlert
Copied!
Last modified 1yr ago
Copy link