You are not logged in.

#1 2022-08-23 17:17:37

lfitzgerald
Member
Registered: 2021-07-16
Posts: 175

Something is overriding ~/.config/mimeapps.list

My computer insists on trying to open PDFs in Librewolf (lol). I use i3wm. KDE is also installed, but not currently used.

I tried setting it to Zathura in a few GUI places (don't remember exactly where) but it seems to not have worked. Naturally I checked "/.config/mimeapps.list".

[Default Applications]
text/html=chromium.desktop
x-scheme-handler/http=chromium.desktop
x-scheme-handler/https=chromium.desktop
x-scheme-handler/about=chromium.desktop
x-scheme-handler/unknown=chromium.desktop
application/pdf=zathura.desktop

[Added Associations]
application/pdf=org.pwmt.zathura-pdf-mupdf.desktop;mupdf.desktop;

Everything seems fine here. I then used the query command:

$ XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default application/pdf
Checking ~/.config/mimeapps.list
Checking ~/.local/share/applications/defaults.list and ~/.local/share/applications/mimeinfo.cache
librewolf.desktop

Aha! This must be the problem. This mysterious mimeinfo.cache is not mentioned in https://wiki.archlinux.org/title/XDG_MIME_Applications at all, and searching around I found an ancient forum post about it: https://forums.fedoraforum.org/showthre … -Gnome-2-8 This didn't really explain much but I took away that mimeinfo.cache is some kind of generated file. I tried "update-mime-database" but that asks for a directory, so I decided it's just for installing new mime types and gave up on it. I then tried "update-desktop-database":

$ update-desktop-database
The databases in [/usr/local/share/applications, /usr/share/applications] could not be updated.

$ sudo update-desktop-database

However this did not change mimeinfo.cache nor the outcome of querying pdf. I then wondered if this whole XDG MIME business is just an overcomplicated, broken POS and deleted mimeinfo.cache. Funnily enough, this made some progress: update-desktop-database does not re-create it, and also PDFs now open with chromium rather than Librewolf:

$ XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default application/pdf
Checking ~/.config/mimeapps.list
Checking ~/.local/share/applications/defaults.list and ~/.local/share/applications/mimeinfo.cache
Checking ~/.local/share/applications/defaults.list and ~/.local/share/applications/mimeinfo.cache
Checking /usr/local/share//applications/defaults.list and /usr/local/share//applications/mimeinfo.cache
Checking /usr/local/share//applications/defaults.list and /usr/local/share//applications/mimeinfo.cache
Checking /usr/share//applications/defaults.list and /usr/share//applications/mimeinfo.cache
chromium.desktop

Note that "~/.local/share/applications/defaults.list" and "~/.local/share/applications/mimeinfo.cache" do not exist.

Unfortunately, my goal is for XDG to honor the ~/.config/mimeapps.list entry for Zathura. So what is going on here and how can I fix it?

Last edited by lfitzgerald (2022-08-23 17:21:45)

Offline

#2 2022-08-23 17:29:33

lfitzgerald
Member
Registered: 2021-07-16
Posts: 175

Re: Something is overriding ~/.config/mimeapps.list

Oh, one more thing: After being frustrated by this nonsense, I went ahead and created a file at "~/.local/share/applications/mimeinfo.cache":

$ cat ~/.local/share/applications/mimeinfo.cache
[MIME Cache]
application/pdf=zathura.desktop;

This seemingly fixed my issue:

$ xdg-mime query default application/pdf
Checking ~/.config/mimeapps.list
Checking ~/.local/share/applications/defaults.list and ~/.local/share/applications/mimeinfo.cache
zathura.desktop

But is this really the fix? The file is called "cache" and it's in "share", so sounds like this is not meant to be edited directly. If I go ahead and check this into my dotfiles, and start adding all my customization to it, will something break down the line?

Offline

#3 2022-08-24 14:25:10

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,038

Re: Something is overriding ~/.config/mimeapps.list

According to https://bbs.archlinux.org/viewtopic.php?id=97886 (who did use the same fedora post) there's a better solution .

create a defaults.list with your desired associations .

Last edited by Lone_Wolf (2022-08-24 14:25:30)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#4 2026-05-15 12:49:11

darthvader
Member
From: The Beehive
Registered: 2013-12-14
Posts: 17

Re: Something is overriding ~/.config/mimeapps.list

I just got here via google, having a similar problem to the title where files in qbittorrent were opening in a browser, the solution was to delete the catchall: x-scheme-handler/file= in ~/.config/mimeapps.list and then:

$ update-mime-database ~/.local/share/mime/

This should help passerbys with the same problem!

Offline

#5 2026-05-15 15:18:51

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,510
Website

Re: Something is overriding ~/.config/mimeapps.list

Please refrain from necrobumping.

Closing.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB