pop-os / cosmic-session

Session manager for the COSMIC desktop environment
GNU General Public License v3.0
68 stars 18 forks source link

Installing flatpaks with `inode/directory` associations causes `xdg-open ~` to use flatpak, not system defaults #39

Closed XV-02 closed 4 months ago

XV-02 commented 7 months ago

On both an existing regularly updated install (over 6 months old) and on a fresh install (literally yesterday), I was noticing that using the Super + F shortcut in cosmic-session was resulting in code-editors installed as flatpaks to open, instead of the current system default of org.gnome.Nautilus.desktop

This does not appear to be a unique problem for either Pop or Cosmic, as I found a couple of issues over the last three years reporting similar behaviour, as well as at least one issue where a standard package install of a code editor was being preferenced by flatpaks and snaps over a file manager.

On my system, running XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default inode/directory resulted in

Checking /home/daniel/.config/mimeapps.list
Checking /home/daniel/.local/share/applications/defaults.list and /home/daniel/.local/share/applications/mimeinfo.cache
Checking /home/daniel/.local/share/applications/defaults.list and /home/daniel/.local/share/applications/mimeinfo.cache
Checking /usr/share/cosmic/applications/defaults.list and /usr/share/cosmic/applications/mimeinfo.cache
Checking /usr/share/cosmic/applications/defaults.list and /usr/share/cosmic/applications/mimeinfo.cache
Checking /home/daniel/.local/share/flatpak/exports/share/applications/defaults.list and /home/daniel/.local/share/flatpak/exports/share/applications/mimeinfo.cache
com.vscodium.codium.desktop

Searching those files for inode/directory pointed to ~/.local/share/flatpak/exports/share/applications/mimeinfo.cache being the culprit:

daniel@iapetus:~$ cat ~/.local/share/flatpak/exports/share/applications/mimeinfo.cache |grep inode
inode/directory=com.vscodium.codium.desktop;

The two other locations which list explicit values for the inode/directory mimetype were /usr/share/applications/mimeinfo.cache

inode/directory=com.system76.CosmicFiles.desktop;org.gnome.Nautilus.desktop;org.gnome.baobab.desktop;

and /usr/share/applications/defaults.list

inode/directory=org.gnome.Nautilus.desktop

I'm not sure why the flatpak's mimeinfo.cache is being preferenced over any other value. I saw this with VSCodium, VSCode, and Lapce, all installed as flatpaks. I have yet to test whether this is true of standard package installs (i.e. installing the .deb for VSCode). Testing that will be my next-step.

XV-02 commented 4 months ago

Looks like this is resolved as of at-least https://github.com/pop-os/cosmic-session/commit/5613bc660649c65b4a4c3fb41605491b9765729a if not earlier.