Set Firefox to Default Browser in xdg Settings

If you use firefox nightly and chromium you've likely ran into the issue where some apps launch chromium as the default browser for URLs. This is ultimately due to firefox nightly not having a true installer which would create the firefox.desktop file that xdg-settings uses to set/determine the browser to open on xdg-open events.

To verify the current settings you can use: xdg-settings get default-web-browser which will likely return chromium.desktop.

To change this, you will need to create a firefox.desktop file and use the xdg-settings command:

  • in a terminal, clear BROWSER: export BROWSER=""
    • just to make sure it is not set which can cause other issues
  • create a firefox.desktop file in /usr/share/applications/ with the following content:
 1[Desktop Entry]
 3Name=Firefox Browser
 4GenericName=Web Browser
 5Comment=Access the Internet
 6Exec=/PATH_TO_FIREFOX_BIN/firefox %U
15[Desktop Action new-window]
16Name=New Window
19[Desktop Action new-private-window]
20Name=New Incognito Window
21Exec=/PATH_TO_FIREFOX_BIN/firefox --incognito

NOTE: you will need to change /PATH_TO_FIREFOX_BIN/ to the path to your firefox binary.

  • change xdg to use firefox: xdg-settings set default-web-browser firefox.desktop
  • check xdg setting: xdg-settings get default-web-browser
  • test the change: xdg-open ""
    • this should open the URL in firefox

Also note you should check the default application (update-alternatives) gnome and default browsers settings:

  • default: update-alternatives --config x-www-browser
  • gnome: update-alternatives --config gnome-www-browser
  • kde: check System Settings > Applications > Default Applications > Web Browser