xdg-open and xdg-mime disagree on the default handler app
xdg-open ~
opens my home folder in "Nemo" although xdg-mime
tells "Visual Studio Code" should be used:
[2019-03-12 15:43:17] janis@janispc:~$ xdg-mime query default inode/directory
com.visualstudio.code.desktop
It looks like the Code's handler is set in Flatpak's /var/lib/flatpak/exports/share/applications/com.visualstudio.code.desktop
(cached in /var/lib/flatpak/exports/share/applications/mimeinfo.cache
), which gets read by xdg-mime
before it gets to /usr/share/applications/defaults.list
, where Nemo is listed as the default app.
The problem here is the inconsistency. Given my mime handler configuration files, should the directories be opened by Code or Nemo? Why does xdg-open
think differently than xdg-mime
?
Output from my current machine:
$ XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default inode/directory
Checking /home/janis/.config/mimeapps.list
Checking /home/janis/.local/share/applications/mimeapps.list
Checking /home/janis/.local/share/applications/defaults.list and /home/janis/.local/share/applications/mimeinfo.cache
Checking /home/janis/.local/share/applications/defaults.list and /home/janis/.local/share/applications/mimeinfo.cache
Checking /usr/share/cinnamon/applications/defaults.list and /usr/share/cinnamon/applications/mimeinfo.cache
Checking /usr/share/cinnamon/applications/defaults.list and /usr/share/cinnamon/applications/mimeinfo.cache
Checking /usr/share/gnome/applications/defaults.list and /usr/share/gnome/applications/mimeinfo.cache
Checking /usr/share/gnome/applications/defaults.list and /usr/share/gnome/applications/mimeinfo.cache
Checking /home/janis/.local/share/flatpak/exports/share/applications/defaults.list and /home/janis/.local/share/flatpak/exports/share/applications/mimeinfo.cache
Checking /home/janis/.local/share/flatpak/exports/share/applications/defaults.list and /home/janis/.local/share/flatpak/exports/share/applications/mimeinfo.cache
Checking /var/lib/flatpak/exports/share/applications/defaults.list and /var/lib/flatpak/exports/share/applications/mimeinfo.cache
com.visualstudio.code.desktop
Output from a freshly installed other machine (no directory handler set for Code):
$ XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default inode/directory
Checking /home/janis/.config/mimeapps.list
Checking /home/janis/.local/share/applications/defaults.list and /home/janis/.local/share/applications/mimeinfo.cache
Checking /home/janis/.local/share/applications/defaults.list and /home/janis/.local/share/applications/mimeinfo.cache
Checking /usr/share/cinnamon/applications/defaults.list and /usr/share/cinnamon/applications/mimeinfo.cache
Checking /usr/share/cinnamon/applications/defaults.list and /usr/share/cinnamon/applications/mimeinfo.cache
Checking /usr/share/gnome/applications/defaults.list and /usr/share/gnome/applications/mimeinfo.cache
Checking /usr/share/gnome/applications/defaults.list and /usr/share/gnome/applications/mimeinfo.cache
Checking /home/janis/.local/share/flatpak/exports/share/applications/defaults.list and /home/janis/.local/share/flatpak/exports/share/applications/mimeinfo.cache
Checking /home/janis/.local/share/flatpak/exports/share/applications/defaults.list and /home/janis/.local/share/flatpak/exports/share/applications/mimeinfo.cache
Checking /var/lib/flatpak/exports/share/applications/defaults.list and /var/lib/flatpak/exports/share/applications/mimeinfo.cache
Checking /var/lib/flatpak/exports/share/applications/defaults.list and /var/lib/flatpak/exports/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
nemo.desktop
I'm using Linux Mint 19.1. You may find more details regarding my case in Linux Mint forums thread – https://forums.linuxmint.com/viewtopic.php?f=47&t=289929