OS=Debian stretch, running LXDE
Clicking on URL links from within non-browser programs, such as pidgin or Thunderbird does not open the links. I discovered that the default browser is set to thunderbird.desktop ... very odd... don't ask me how that got set.
$ xdg-settings get default-web-browser thunderbird.desktop Trying to set the default browser with xdg-settings does not work:
xdg-settings set default-web-browser firefox-esr.desktop $ xdg-settings get default-web-browser thunderbird.desktop Interestingly update-alternatives --get-selections shows firefox-esr as the default browser.
$ update-alternatives --get-selections |grep browser gnome-www-browser auto /usr/bin/firefox-esr infobrowser auto /usr/bin/info www-browser auto /usr/bin/w3m x-www-browser auto /usr/bin/firefox-esr I also tried an entry in ~/.local/share/applications/defaults.list
$ cat ~/.local/share/applications/defaults.list text/html=firefox-esr.desktop; Nothing is working. Any help appreciated.
Update:
These lines in ~/.config/mimeapps.list were set to thunderbird.desktop. I changed them to firefox-esr.desktop, but still no change.
application/x-extension-htm=firefox-esr.desktop application/x-extension-html=firefox-esr.desktop application/x-extension-shtml=firefox-esr.desktop application/xhtml+xml=firefox-esr.desktop application/x-extension-xhtml=firefox-esr.desktop application/x-extension-xht=firefox-esr.desktop Update:
The command xdg-mime query filetype index.html comes back empty. In fact it comes back empty with other filetypes as well. This has to mean something. However mimetype works.
$ mimetype index.html index.html: text/html [SOLVED] as per Xen2050's answer
Here is a summary of what I did, in case others have a similar problem:
I had to find all ''mimeapps.list'' and ''defaults.list'' files:
locate mimeapps.list locate defaults.list Then delete them...
rm ~/.config/mimeapps.list ... Then run:
update-desktop-database In my case I got an error message about a faulty mime-type with evince (sorry, can't remember the exact message). So i purged evince:
apt-get purge evince apt-get purge thunderbird #just for good measure Try again:
update-desktop-database The problem was still not solved, so I went on to install ''exo-preferred-applications'', which in Debian is the package ''exo-utils''. Then reinstall thunderbird. I don't need evince so didn't reinstall it.
apt-get install exo-utils apt-get install thunderbird Then ran ''exo-preferred-applications''. Firefox was not listed under "Web Browsers", so I chose ''other'' and pasted in ''firefox-esr.desktop''. Then ran:
update-desktop-database Working!!!:
$ xdg-mime query default x-scheme-handler/http firefox-esr.desktop $ xdg-mime query default x-scheme-handler/https firefox-esr.desktop The original problem of clicking on links in non-browser applications is also now solved.
23 Answers
The GUI's "Settings" -> "Preferred applications" looks like it sets xdg-settings get default-web-browser also, perhaps differently and definitely with an easier interface, so try there.
- It looks like it runs
exo-preferred-applications - Might rely on the file
/usr/share/applications/exo-web-browser.desktop(or corresponding file in/usr/local/or~/.local) containingExec=exo-open --launch WebBrowser %u
Also try
sudo update-alternatives --config x-www-browser Also, checking the default mimetypes command you were looking for was probably one of these:
xdg-mime query default x-scheme-handler/http xdg-mime query default x-scheme-handler/https If MIME types were changed, the command [sudo] update-desktop-database might help.
Problem already known in Debian GNU/Linux 8 alias Jessie. No matter whether you LXDE or Gnome. :-(
Here ist the Evince error message:
~$ sudo update-desktop-database Error in file "/usr/share/applications/evince.desktop": "" is an invalid MIME type ("" does not contain a subtype)
I purged evince. Not needed, too...
My System:
~$ uname -a Linux 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3 (2019-09-02) x86_64 GNU/Linux
For what it's worth: I've also just faced this problem, and solved it by overriding, as user root, /usr/share/applications/mimeinfo.cache with the appropriate values for x-sceheme-handler/http, etc.
For some reason it seems that this file takes precedence over any local, user-writable files.