My problem is that many programs call xdg-open to open websites but on my Manjaro system (based on Arch Linux) this is somehow bound to cups :)

When such a call to xdg-open happens, the CPU usage goes up a lot, without anything happens. I restart because the laptop gets hot very quickly.

~ $ xdg-settings get default-web-browser

When I want to change that, I get the following response:

~ $ xdg-settings set default-web-browser firefox.desktop
xdg-settings: $BROWSER is set and can't be changed with xdg-settings

I can go ahead and change the environment variable for the browser and I'm fixed, BUT only for this one terminal. How could I make this change permanent or add it to autostart?

I'm using: i3 4.12, fish shell

  • I don't use a desktop, so don't have the right setup and cannot say what GUI tool does this for you, but there is a file ~/.local/share/applications/preferred-web-browser.desktop on my system that has Exec=firefox %u in it.
    – meuh
    Sep 3 '16 at 19:02
  • thanks meuh. my issues arise from programs calling xdg-open though which then calls the connected '.desktop' file, that is connected with the task (=default-web-browser in this case). The .desktop file that gets called is cups.desktop, which i find a bit weird and i'm considering deleting cups, because i don't print anyway :)
    – joemaro
    Sep 9 '16 at 15:34

I had this issue since Chromium made itself the default browser each time I installed it.

Using xdg-mime fixed it:

xdg-mime default firefox.desktop x-scheme-handler/https x-scheme-handler/http

On my Arch Linux system, this added two lines to ~/.config/mimeapps.list, associating HTTP and HTTPS with Firefox.

Now I can have both Firefox and Chromium installed with Firefox being the default browser.

  • 2
    Add text/html as an argument to also handle .html files in the file system.
    – Alicia
    Dec 20 '20 at 16:28
  • Thanks, this worked for me in Crostini to keep using garcon to open the native browser in ChromeOS but use the chrome binary for running selenium Mar 3 '21 at 21:08

Check the BROWSER variable in /etc/profile and /etc/environment and eventually in your ~/.bashrc. It is probably set to /usr/bin/xdg-open so you should consider to change it to avoid the recursive call.

  • I have no browser variable in any of those files, is this no longer viable for recent vers?
    – Mark Deven
    Jan 26 '20 at 3:30
  • 3
    My experience: I had BROWSER=firefox in ~/.bashrc but an application still opened URLs in chromium. xdg-settings get default-web-browser produced chromium.desktop, but wouldn't let me set it due to $BROWSER existing. I had to open a new terminal, do export BROWSER="", then run xdg-settings set default-web-browser firefox.desktop and then the application opened urls in firefox. I find that weird, as it's acting like $BROWSER supersedes (and thus won't set), but it wasn't occuring like this in practice. Adding note for anyone else running into this.
    – Hendy
    Mar 27 '20 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.