I3 Default Browser Change

Hello I’m working to change my default browser and not sure how to do it with Endeavour and i3.

I attempted the following:

xdg-settings set default-web-browser vivaldi.desktop

and received the following:

xdg-settings: $BROWSER is set and can't be changed with xdg-settings

I’ve looked through my bashrc and a handfull of other places mentioned online where this may be set without luck. If anyone can point me in the right direction that would be much appreciated.

I’m assuming $BROWSER is set somewhere I haven’t looked yet.

1 Like

Welcome Aboard!

Why not simply edit i3 config and change the browser from ex. firefox to vivaldi? This way if the default config browser is mod+w launches firefox replace firefox with vivaldi. If you are also using the launcher icon in the bar you would also need to edit the i3 blocks config the same way.

1 Like

Thanks for the speedy response. I’ve done this, but when I click on a link in say discord, it launches firefox still. This was why I was looking at changing the browser with xdg because I figured that would do it at a system level.

Check your ~/.bashrc.
For example I have there this for a reason I already forgot.

export BROWSER='/usr/bin/firefox'           # default web browser

I don’t have it form EnOS i3 defaults by the way.

P.S. It’s along the usual EDITOR, VISUAL and PAGER

export EDITOR='/usr/bin/micro'              # default text editor
export VISUAL='/usr/bin/micro'
export PAGER='/usr/bin/less'

Also, I do not think i3wm properly follows xdg mime types. But maybe that’s just my system. I never bothered to properly configure it.

1 Like

Thanks! While these weren’t in my bashrc or zshrc (I just installed it so I checked both in case) I went ahead and added export BROWSER='/usr/bin/vivaldi-stable' to my .zshrc and it worked like a charm.

I had thought to check these in both files earlier, but figured I’d double check to be sure and that’s when I thought to just add it.

Spoke too soon. Seemed to work and then stop working. Maybe I should attempt a reboot to doublecheck?

Open the terminal and try echo $BROWSER what is returned.
It is possible that you have BROWSER variable defined also somewhere else like ~/.profile or ~/.xinitrc or somewhere in /etc folder.
I think that’s what is said in the xdg-settings message that this variable is already defined and xdg therefore couldn’t change the default browser.

You can try to look for it with this

grep -R BROWSER /* 2> /dev/null

It may take a long time since it will open and read every file in your computer and look for word BROWSER in it. Maybe try to first limit it on your home directory ~/* instead of /*.

But also you are correct you have to logout and login when you change .bashrc just to be sure it is correctly sourced.

I did what you mentioned and nothing jumped out at me. Some instances I found where it was defined it was done so as a list of browsers. Interesting update, I downloaded brave and updated that to my default browser, that actually changed. Seems like it’s vivaldi specific, which is odd.

I’ll try to track down those lists again to see if brave is on them and vivaldi isn’t. I don’t remember seeing brave on any of those. Maybe I missed it at that list needs to be udpated.

In case anyone else is having this issue, changing every instance of firefox.desktop to chromium.desktop in ~/.config/mimeapps.list worked for me.

I had the same Issue and I want to add this for future references …
Changing the BROWSER-Variable in
/usr/lib/environment.d/99-environment.conf toBROWSER=/usr/bin/vivaldi-stable
and calling xdg-mime default vivaldi-stable.desktop x-scheme-handler/https x-scheme-handler/http in the Terminal worked for me

And people complain about setting a default browser in Windows… oof lol

When you manualy change anything in /usr/lib you risk that a new (pacman) update will rewrite your changes or fail to update system.
You are safer to change propriate entry under /etc or even better under your home folder ~/. Most config parsers go first to ~/ then /etc and if nothing was found then it defaults to /usr.
Your source also doesn’t say anything about changing files in /usr/lib.

At least when I set default browser in linux system it stays that way and doesn’t automatickly change with a new update.


settings for user specific stuff should always be set inside users home environment and not systemwide.
And we do set this already per default.

1 Like

I just installed the i3-flavored EndeavourOS and been liking it so far but ran into this issue.

EndeavourOS does not ship with a ~/.config/mimeapps.list file by default.
I guess Firefox is put as the default one in /usr/share/applications/mimeinfo.cache when it is installed on the system. It is also set as the default in /etc/environment.

To override the cache, it is possible to copy the mime types where Firefox is set as the default
from /usr/share/applications/mimeinfo.cache to ~/.config/mimeapps.list, and removing firefox.desktop or putting it last:

[Default Applications]

Alternatively, the command xdg-mime default org.qutebrowser.qutebrowser.desktop application/x-xpinstall application/xhtml+xml text/html text/xml x-scheme-handler/http x-scheme-handler/https can be used.

The $BROWSER environment variable can be changed through export BROWSER=qutebrowser in an autosourced file like .bashrc or .zshrc.

is the only place where we add firefox as the default browser.
And I do not see the question/issue you have?
If we would set firefox as the default browser in multiple places changing it would be a mess for the user.

And welcome here on the purple side :enos_flag:

Thanks for the welcome.

My issue was the same as OP, xdg-settings set default-web-browser returned $BROWSER is set and can't be changed with xdg-settings ; I just wanted to post my solution to configure the default browser both for apps that use xdg-open and apps that use $BROWSER.