SUMMARY When VSCode is installed, it prepends itself to the `/usr/share/applications/mimeinfo.cache` file of the host/sandbox. On GNOME this seems to be handled fine, but on KDE and some other DE's this appears to cause apps leveraging xdg-open to prefer VSCode over Dolphin. This manifests as either "open folder" buttons failing to launch any app at all (appearing broken) or opening VSCode instead of Dolphin/preferred file picker, which usually breaks application functionality. STEPS TO REPRODUCE 1. Install VSCode on a KDE system. 2. Attempt to open a folder via an app that relies on xdg-portals. (2 examples are gdlauncher and prism launcher if you're in your bi-annual Minecraft phase like I am) OBSERVED RESULT Nothing happens, or VSCode launches. Using `journalctl -f` you can observe failed launches of vscode. Appears that these happen mainly when VSCode is installed as a Snap (And possibly Flatpak but I didn't check) EXPECTED RESULT Dolphin opens. SOFTWARE/OS VERSIONS Operating System: KDE neon 5.27 KDE Plasma Version: 5.27.8 KDE Frameworks Version: 5.110.0 Qt Version: 5.15.10 Kernel Version: 6.2.0-33-generic (64-bit) Graphics Platform: X11 Processors: 12 × AMD Ryzen 5 4600H with Radeon Graphics Memory: 22.8 GiB of RAM Graphics Processor: NVIDIA GeForce GTX 1650 Ti/PCIe/SSE2 Manufacturer: Acer Product Name: Nitro AN515-44 System Version: V1.04 ADDITIONAL INFORMATION Issue on VSCode's repo: https://github.com/microsoft/vscode/issues/114425 The maintainers seem to believe they're doing what is believed to be standard practice when it comes to setting mimetypes. It could be that KDE and other distros are parsing this file incorrectly (or GNOME is doing it wrong and everyone has just assumed the outliers are wrong). Though I'm speculating on all fronts. As a suggestion, Plasma could do more to suggest which app should be used to attempt to open an xdg-mimetype when multiple apps are available like Android does. Right now, this is something only available in Dolphin via the "Open with..." dialog, but making this a cross-system option would help with UX in these fiddly edge-cases.
What does `xdg-mime query default inode/directory` run in a terminal window print out? Can you attach your fill /usr/share/applications/mimeinfo.cache file? I strongly suspect they're *prepending* their app ID to the inode/directory= key in that file, rather than *appending* to it, as they should.
I'd like to note that this issue disappeared for me after a reboot.
(In reply to Nate Graham from comment #1) > What does `xdg-mime query default inode/directory` run in a terminal window > print out? > > Can you attach your fill /usr/share/applications/mimeinfo.cache file? > > I strongly suspect they're *prepending* their app ID to the inode/directory= > key in that file, rather than *appending* to it, as they should. https://gist.github.com/TDuffinNTU/1685cfd2727b88e3c5ccc9bfdfeb65ee That is exactly what happened when I installed VSCode, as shown from the mimeinfo.cache I've linked above (line 262). The issue resolved itself once I moved the "code.desktop" entry to the end of the list. However, if I revert the change (Which causes the issue to start again) running `xdg-mime query default inode/directory` *still* returns org.Kde.Dolphin :/ There's a lot more discussion that might be helpful as part of the github issue that also might help give some extra context If you check the link I provided in "Additional Details" in the original ticket, the VSCode contributors seem to be unsure what the best practice is. It might be worth replying there to add your input as they were looking for people with domain experience with this.
Thanks, I'll follow up there.
*** Bug 438006 has been marked as a duplicate of this bug. ***