How do I change my default browser in Sway? I tried setting the BROWSER variable in /etc/environment to waterfox-g3 and rebooting, but when I open a link in a program like WezTerm or Discord, firefox is opened instead.
At first you should check if the variable is actually set (echo $BROWSER). If it isn’t set, you should try to change the variable inside the “.profile” file in your home folder, if you are using the eOS community install.
For me it has always been a mystery what file will set the environment variables under what conditions.
I opened my shell and typed
echo "$BROWSER" and it’s set to waterfox-g3, as I had configured it. Just in case, I also added
"export BROWSER=waterfox-g3" to ~/.profile and rebooted to see if it changed anything and it appears that nothing changed. However, right as I was typing this response, I had the idea to uninstall firefox, since I did that on my previous installation and haven’t had this issue then and it seems to have worked. Thanks anyways for your help.
This is not a solution to this problem. All you accomplished was to make waterfox the only availiable browser on your system to be used (default). It would be misleading to others to leave your post marked as the solution.
Oh, sorry about that.
I think we need a flag setup for “Workaround” as well as “Solution”. Sometimes that’s all you get…
We could actually try to find an actual fix as well. Try:
xdg-settings set default-web-browser <insert the filename>.desktop
You would need to do this for each application you want to open with waterfox.
that be my guess … i only use firefox on sway …
Test in terminal
xdg-open htps:// " what you want "
if want full function need change firefox in configs ( say if want mod+o to open waterfox )
It would seem xdg-settings dictates the actual browser to use.
It just refuses to change it while BROWSER is defined.
I removed the variable from /usr/lib/environment.d/ and it now works fine.
I’ve just started using endeavour a couple days ago and haven’t checked if 3rd party programs will open in the new default but I hope this helps.
Navigate your way to [user]/.config/sway/config.d/, from there open application_defaults and change every instance of “firefox” to [whatever you want].
(after a quick check “echo $BROWSER” still returns firefox so this might not help you )
If you want mod+o to be different you can change it in the “default” file in the same directory
The changes to application_defaults only affects how sway will open the browser. To be more precise it defines on which workspace Firefox (or any program) will open , if the focus should be on the newly opened window and, in the case of Firefox, if it should inhibit the idle state when full screen. It doesn’t have any effect on what the default browser is and even if those lines are deleted, Firefox should work just the same.
Hmm, my searches just don’t return #BROSWER anywhere in the .bashrc. it looks like it’s defined somewhere in /etc/pacman.d/gnupg/S.dirmngr but I can’t even sudo my way into it which means I(and others, this means you reader) should NOT edit it.
That said, after some troubleshooting(sorry new users, I’ll try to pinpoint where the change occurred after some gardening) if I echo $BROWSER I get /usr/bin/chromium and calling just $BROWSER brings up an instance of chromium.
I’ll try a link through IRC soon to see if this is a true fix.