Ok, after digging through a whole heap of stuff, I found that Chromium uses
xdg-open to open files on Ubuntu.
The solution for me was to reconfigure
xdg-open using the
xdg-mime command as follows:
First, you need to know that
xdg-mime works using
.desktop files, for some reason. This is how it works out what programme it should use to open a file when Chrome calls it with
I use i3wm, a desktopless environment. In my case, the
.desktop files I found were stored in
~/.local/share/applications/. If you take a look in here, you will probably see a load of different ones for various programmes you've installed.
(Note: if you use normal Ubuntu, it may be the case that
xdg-mime simply uses the desktop files in
~/Desktop. You may need to adapt these instructions, so if they don't work, or there's nothing in
~/.local/share/applications/, just do everything the same but replacing
Anyway, if you run the command
xdg-mime query default application/pdf
you'll be told something like (in my case):
This is a desktop file that was installed by wine at some point. I don't know why
xdg-mime thinks it's the right one to use, but somehow it's decided to use it as the default to open pdf files. Why this also leads to Gimp being used, I also have no clue.
cd ~/.local/share/applications/ and confirm that this is the location of this
wine-extension-pdf.desktop file (or whatever it is on your computer). Then, you need to create a new
.desktop file. Call it something like
pdf-evince.desktop, and give it the contents:
Feel free to replace
evince with your favourite pdf viewer.
You now need to register this new desktop link to be the default with
xdg-mime, so run:
xdg-mime default pdf-evince.desktop application/pdf
Now go back to Chromium and try to open a downloaded pdf. It should open in your chosen pdf viewer!