Skip to content

Instantly share code, notes, and snippets.

@philocalyst
Last active May 30, 2025 19:41
Show Gist options
  • Save philocalyst/ad9f6d7cc08a9cdefa795e1b70d6e7d1 to your computer and use it in GitHub Desktop.
Save philocalyst/ad9f6d7cc08a9cdefa795e1b70d6e7d1 to your computer and use it in GitHub Desktop.
Set Default Openers for Url Patterns using Hammerspoon
-- Make sure this is installed and placed within your spoons directory (https://github.com/Hammerspoon/Spoons/raw/master/Spoons/URLDispatcher.spoon.zip)
local urlDispatcher = hs.loadSpoon("URLDispatcher")
if urlDispatcher then
-- Configure Spoon variables directly
urlDispatcher.set_system_handler = true -- Attempt to set Hammerspoon as default browser
urlDispatcher.url_patterns = {
-- Notion links -> Chrome
{ "^https?://.*%.notion%.site", "com.google.Chrome" },
-- Zoom links -> Zoom App
{ "^https?://zoom%.us/j/", "us.zoom.xos" },
{ "^https?://[%w]+%.zoom%.us/j/", "us.zoom.xos" },
}
urlDispatcher.default_handler = "com.apple.Safari" -- Fallback Safari
-- urlDispatcher.logger:setLogLevel('debug')
-- Start the dispatcher
urlDispatcher:start()
else
-- Handle loading failure
hs.alert.show("Error: Failed to load URLDispatcher Spoon. Is it in ~/.hammerspoon/Spoons/?")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment