Brave Browser Logo

Default woes

I had a problem after I uninstalled Firefox in that I couldn’t set my new browser (which is Brave) to be the default. Clicking the button in Brave made no difference. No errors - the button disappeared as if it had worked, but it hadn’t.

Normally when setting defaults in Linux, in the background it uses something like xdg-settings set default-web-browser brave-browser.desktop. If I tried executing this on the command line I was being given a cryptic message that $BROWSER had been set and the default browser couldn’t be changed. Getting closer to the solution…

Fix

After a bit of hunting around I found a file called /etc/environment that holds some default variables no matter what the session. The BROWSER variable was being set in here (thanks Endeavour).

So, you can simply remove this variable and reboot (I’m not sure if logging out would do it, but I doubt it). When you’re back up, open your browser and set it default in its options, or use the xdg-settings command listed above.

There are also other potential places the environment variables could be set, such as /etc/profile ~/.bashrc (or any other shell config file if you don’t use bash) or even ~/.profile. I think, for X sessions they could also be in ~/.xinitrc although unlikely.

Flatpak?

As a final note, if you’re using a flatpak version of your browser, have a look to see what your .desktop files look like and pick one accordingly. They can be found in /usr/share/applications and also in your home folder at ~/.local/share/applications. For Brave it was called com.brave.Browser.desktop