Last active
September 19, 2024 06:16
-
-
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)
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
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 |
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
More about this: https://igregory.ca/2020/hammerspoon-browser-picker/