You are not logged in.

#1 2022-12-24 10:22:18

OrakMoya
Member
Registered: 2019-09-22
Posts: 69

[Solved] VS Code took over opening file/folder paths.

Hello,

Visual Studio Code somehow took over opening folder paths. E.g. I go into Transmission > Open Folder (of torrent) and that folder opens in Visual Studio Code, instead of my file manager Dolphin. Or in Gnome Disks, clicking the mount point of a drive also opens in VS Code.

In Firefox, however, clicking "Show in Folder" of a downloaded file does open in Dolphin.

How would I fix this?

Last edited by OrakMoya (2022-12-24 16:07:51)

Offline

#2 2022-12-24 15:01:15

seth
Member
Registered: 2012-09-03
Posts: 45,028

Re: [Solved] VS Code took over opening file/folder paths.

Uninstall vscode. /sarcasm

Is it the repo version or some flatschpak?

cat /usr/share/applications/code-oss-url-handler.desktop
cat /usr/share/applications/code-oss.desktop
cat /usr/share/applications/org.kde.dolphin.desktop

For reference: https://wiki.archlinux.org/title/XDG_MIME_Applications

Online

#3 2022-12-24 16:00:24

OrakMoya
Member
Registered: 2019-09-22
Posts: 69

Re: [Solved] VS Code took over opening file/folder paths.

It is the AUR visual-studio-code-bin package.

Relevant line I believe in order:

MimeType=x-scheme-handler/vscode;
MimeType=text/plain;inode/directory;application/x-code-workspace;
MimeType=inode/directory;

In System Settings'  File Association page, VS Code is last in order of preference for opening the inode/directory, as well as everything else inside the inode category.

Last edited by OrakMoya (2022-12-24 16:01:25)

Offline

#4 2022-12-24 16:07:39

OrakMoya
Member
Registered: 2019-09-22
Posts: 69

Re: [Solved] VS Code took over opening file/folder paths.

Using the selectdefaultapplication-git package I found on the wiki page you linked, I set dolphin as the default for opening inode/directory type and that fixed the problem. Not sure why System Settings showed Dolphin already first on the list for that type but it looks like it somehow got desynced.

Offline

#5 2022-12-24 16:12:13

seth
Member
Registered: 2012-09-03
Posts: 45,028

Re: [Solved] VS Code took over opening file/folder paths.

MimeType=text/plain;inode/directory
MimeType=inode/directory;

That is in one of the code-oss*.desktop files?
Or is the last one from dolphin?
(Please don't post excerpts out of context - you know the context and believe to know what's relevant. We don't and tehrefore also cannot judge the relevance)

In System Settings'  File Association page

You can forget about that, it'll apply to KDEs stuff, but most tools will probably use xdg-open

xdg-mime query default "inode/directory"

This is probably down to the aur package you're using, the repo package doesn't register for inode/directory

Online

#6 2023-07-11 06:01:16

chalo
Member
Registered: 2015-08-21
Posts: 1

Re: [Solved] VS Code took over opening file/folder paths.

Modifiy the appropiate line in /usr/share/applications/mimeinfo.cache switching the order of "code" and "nautilus".

From:

inode/directory=code.desktop;org.gnome.Nautilus.desktop;

To

inode/directory=org.gnome.Nautilus.desktop;code.desktop;

Last edited by chalo (2023-07-11 06:04:15)

Offline

#7 2023-07-11 07:50:10

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 20,161

Re: [Solved] VS Code took over opening file/folder paths.

The real fix is to set the default locally properly for your user in the appropriate mime config files. The cache file is that, a cache file. It will get overwritten the next time you install something that claims inode/directory and/or rebuilts the mime cache - which is everytime you install something with new associations.

https://wiki.archlinux.org/title/Default_applications

Offline

Board footer

Powered by FluxBB