Handle URL events received by Hammerspoon 2.
The module responds to hammerspoon2:// URLs and, when Hammerspoon 2 is
configured as the system default handler, also to http://, https://,
and mailto: URLs.
Responding to custom hammerspoon2:// events
URLs take the form hammerspoon2://eventName?key=value&key2=value2.
The host component (eventName) selects the registered callback.
// Remove a binding hs.urlevent.bind("myEvent", null)
Intercepting http / https / mailto URLs
Set hs.urlevent.httpCallback (or mailtoCallback) to a function.
You must also set Hammerspoon 2 as the system default handler for the
relevant scheme — see setDefaultHandler(_:_:).
hs.urlevent.httpCallback = (scheme, host, params, fullURL, pid) => { // Forward to a real browser rather than swallowing the link hs.urlevent.openURLWithBundle(fullURL, "com.apple.safari") }
Handle URL events received by Hammerspoon 2. The module responds to
hammerspoon2://URLs and, when Hammerspoon 2 is configured as the system default handler, also tohttp://,https://, andmailto:URLs.Responding to custom hammerspoon2:// events
URLs take the form
hammerspoon2://eventName?key=value&key2=value2. The host component (eventName) selects the registered callback.Intercepting http / https / mailto URLs
Set
hs.urlevent.httpCallback(ormailtoCallback) to a function. You must also set Hammerspoon 2 as the system default handler for the relevant scheme — seesetDefaultHandler(_:_:).Querying and changing default handlers