Comment 3 for bug 1823917

Revision history for this message
ԜаӀtеr Ⅼарсһуnѕkі (wxl) wrote : Re: Can't set Chromium as the default browser

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

That's some telling info right there.

Some things to note:

 * In lxqt-config-session, in both Default Applications and Environment (Advanced) there is an option to set the BROWSER variable. It is set to firefox by default. It will come back if it is deleted (possibly a bug). Unlike TERM or EDITOR, which are part of the UNIX standard (http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_01), BROWSER is not always recognized by applications.

 * There is a Freedesktop Specification for MIME types (https://www.freedesktop.org/wiki/Specifications/mime-apps-spec/) that lxqt-config-file-associations interacts with. The xdg-utils (XDG = X Desktop Group, the former name of Freedesktop) tools interact with this. You can use them to find out which is your default browser via `xdg-mime query default text/html`. Similarly, `xdg-open` determines the MIME type of the argument it is given and passes it to the associated application.

 * There is also update-alternatives which allows you to assign different definitions of various types of generic programs. For example, you could easily select from different definitions for x-www-browser. I mention this for completeness, but it's not particularly relevant.

Now to prove this is not an issue with LXQt, consider this scenario:

 1. Load Lubuntu, which has firefox installed by default
 2. Install Opera
 3. Note that `echo $BROWSER` returns "firefox"
 4. Note that `xdg-mime query default text/html` returns "firefox.desktop"
 5. Note that `xdg-settings get default-web-browser` returns "firefox.desktop"
 6. Note `xdg-open http://ubuntu.com` opens in firefox
 7. Open qterminal and `echo 'http://ubuntu.com'`
 8. Note that holding down Ctrl and clicking on the URL opens it up in firefox
 9. Open up Opera and set it as the default browser
10. Note that `echo $BROWSER` returns "firefox"
11. Note that `xdg-mime query default text/html` returns "opera.desktop"
12. Note that `xdg-settings get default-web-browser` returns "opera.desktop"
13. Note `xdg-open http://ubuntu.com` opens in opera
14. Open qterminal and `echo 'http://ubuntu.com'`
15. Note that holding down Ctrl and clicking on the URL opens it up in opera

So why the problem with chromium-browser? Let's get back to that quote:

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

When you try to make chromium-browser default, it sees the BROWSER variable and just gives up, whereas Opera (and Firefox) ignores it and actually sets it. This error is actually from xdg-settings. It won't set default-web-browser while BROWSER exists. Yet, somehow firefox and opera both seem to deal with this. Therefore, I would call this chromium-browser's fault.