Last active
May 30, 2025 19:41
-
-
Save philocalyst/ad9f6d7cc08a9cdefa795e1b70d6e7d1 to your computer and use it in GitHub Desktop.
Set Default Openers for Url Patterns using Hammerspoon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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