Skip to content

Instantly share code, notes, and snippets.

@ThatsJustCheesy
Last active March 11, 2024 17:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThatsJustCheesy/c7b9d526ec13e36fd7331b1c043a96ed to your computer and use it in GitHub Desktop.
Save ThatsJustCheesy/c7b9d526ec13e36fd7331b1c043a96ed to your computer and use it in GitHub Desktop.
Hammerspoon web browser picker (set Hammerspoon as your default web browser and add this code to your config)
hs.urlevent.httpCallback = function(scheme, host, params, fullURL)
if host == nil then
host = 'file'
end
local success, _, res = hs.osascript.applescript('choose from list {"Safari", "Brave"} with prompt "Open '..host..' with…"');
local app
if success and res:match('Safari') ~= nil then
app = 'com.apple.Safari'
elseif success and res:match('Brave') ~= nil then
app = 'com.brave.Browser'
else
return
end
hs.urlevent.openURLWithBundle(fullURL, app)
end
@ThatsJustCheesy
Copy link
Author

@Ryan-the-hito
Copy link

This really helped me! Thanks a looooooooot!🥰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment