How to Change the Default Browser in Arch Linux i3 Window Manager

Fix default browser in Arch Linux i3: override Pale Moon with Chrome using xdg-settings, mimeapps.list, and the BROWSER variable.

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:

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

Checking the current default or trying to set it gives:

1
2
3
4
5
# Get the default browser
xdg-settings get default-web-browser

# This would change the default browser but fails with the above error
xdg-settings set default-web-browser google-chrome.desktop

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:

1
vim ~/.config/mimeapps.list

Under the [Default Applications] section, set something like:

1
2
3
text/html=google-chrome.desktop
x-scheme-handler/http=google-chrome.desktop
x-scheme-handler/https=google-chrome.desktop

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:

1
export BROWSER=/usr/bin/google-chrome-stable

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 .desktop name 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.

comments powered by Disqus
Citizix Ltd
Built with Hugo
Theme Stack designed by Jimmy