This page looks best with JavaScript enabled

Set default browser using xdg-settings

 ·  🎃 kr0m

It’s very annoying to have a default web browser and have some applications insist on opening another one. In my case, it happened when I switched from Firefox to Chrome, Telegram insisted on opening URLs using Chrome. To change the default browser globally within X, we will use xdg-settings.

Make sure we don’t have the BROWSER environment variable assigned. If we have it, we look for how that value got there, it’s probably due to the RC script of our shell, in any case, it should be null:

echo $BROWSER

Check the available applications.

  • FreeBSD:

    ls -la /usr/local/share/applications/

      -rw-r--r-- 1 root wheel 323 Mar 10 16:56 chromium-browser.desktop
      -rw-r--r-- 1 root wheel 9117 Mar 26 06:44 firefox.desktop
    
  • Linux:

    ls -la /usr/share/applications/

      -rw-r--r-- 1 root root 8411 mar 16 22:50 google-chrome.desktop
      -rw-r--r-- 1 root root 325 mar 13 08:14 firefox.desktop
    

Assign one of the available web browsers:

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

If you liked the article, you can treat me to a RedBull here