How to open Evince hyperlinks in default browser?

Running Ubuntu 18.04 with Gnome Shell, when clicking on a hyperlink in Evince it opens in Firefox, instead of Chromium which I have set as my default browser.

I have set the default browser through the settings GUI, and also by running the following commands:

sudo update-alternatives --set x-www-browser /usr/bin/chromium-browser                                                                                                                    
sudo update-alternatives --set gnome-www-browser /usr/bin/chromium-browser
xdg-settings set default-web-browser chromium-browser.desktop

I have added the following lines to ~/.config/mimeapps.list:

x-scheme-handler/http=google-chrome.desktop
x-scheme-handler/https=google-chrome.desktop

I have verified that the following commands all open with Chromium:

xdg-open test.html
x-www-browser test.html
gnome-www-browser test.html
sensible-browser test.html

The BROWSER environment variable is unset by default on my system, but even when running Evince with this variable set links still open in Firefox:

BROWSER=/usr/bin/chromium-browser /usr/bin/evince test.pdf

What else can I try to make links clicked in Evince open in my default browser?


The following commands now work, allowing the default browser to be changed without even needing to restart Evince:

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

I'm not sure why these did not work when I originally asked the question; I can only imagine that some factor was reset by restarting the system during my testing.


Same problem reported here: How to set default browser for PDF reader Evince on Linux?

Solving your issue is like voodoo, even when there are "protocols" regarding how and which applications are supposed to open a specific kind of file. You'll see that they're very inconsistent between systems and different desktop environments.

So there's no really a "right" answer. I had a similar problem with firefox, so I'm giving you my solution:

Create a ~/.local/share/applications/defaults.list if it doesn't exist

Add the following

[Default Applications]
application/pdf=evince.desktop;

...or just the last line if there's something before.