On a fresh Arch Linux install with the i3 window manager, the default browser is often Pale Moon. If you prefer Google Chrome (or another browser), changing it via the usual method can fail with an error about $BROWSER being set. This guide shows how to set your preferred default browser when xdg-settings refuses to change it.
The problem
After a fresh install, running xdg-settings set default-web-browser google-chrome.desktop may fail. In the terminal you see:
| |
Checking the current default or trying to set it gives:
| |
xdg-settings will not override the default web browser when the BROWSER environment variable is already set (for example in .profile).
Solution
Use two places: the MIME associations file and the BROWSER variable in your profile.
1. Set the default browser in mimeapps.list
Edit ~/.config/mimeapps.list and replace all references of palemoon.desktop (or whatever the current default is) with your browser’s .desktop name, for example google-chrome.desktop:
| |
Under the [Default Applications] section, set something like:
| |
Adjust the left-hand side if your file uses different MIME types; the important part is the right-hand side (google-chrome.desktop or your browser’s desktop file name).
2. Set BROWSER in your profile
The BROWSER variable is usually set in ~/.profile (or /home/$USER/.profile). Find the line that sets BROWSER and set it to your browser’s executable, for example:
| |
If you use another browser, use its binary path (e.g. firefox, chromium) and ensure the variable is exported in the same file. Then log out and log back in (or start a new session) so the change is picked up.
Verifying
- Run
xdg-settings get default-web-browser— it should report your chosen browser’s.desktopname if the MIME default is set correctly. - Open a link from a terminal with
xdg-open https://example.com— it should open in your new default browser. - In i3, opening URLs (e.g. from a launcher or keybinding) should use the same browser.
Summary
When i3 on Arch Linux keeps using Pale Moon (or another browser) because $BROWSER is set, update ~/.config/mimeapps.list to set your preferred browser for text/html and x-scheme-handler/http / https, and set export BROWSER=/path/to/your-browser in ~/.profile. After re-login, your chosen browser will be used as the default.