Prevent opening Visual Studio Code when click Show In Folder in Chrome

Viewed 3453

I've been googling and fighting this for a half a day already.

When I download something in Google Chrome I want to go to the folder with a file. But when I press 'Show in folder' a Visual Studio Code starts instead of my Thunar. How can I fix this?

Firefox opens folders ok but Chromium, Google-Chrome and Opera kicks of Visual Studio Code.

My system is Linux Mint Tara. I've already tried some things. Like added

[Default Applications]
inode/directory=Thunar.desktop

to /home/[user]/.config/mimeapps.list

Completely removed code.desktop from /usr/share/applications/mimeinfo.cache

Ran xdg-mime default Thunar.desktop inode/directory and the output of xdg-mime query default inode/directory is Thunar.desktop!!!

Even fully removed code.desktop from filesystem. Nothing worked!

Please help, this annoys me so much.

3 Answers

This is caused by MimeType=text/plain;inode/directory; which can be found in /usr/share/applications/code.desktop for what I can find.

What fixed it for me is changing this line to MimeType=text/plain; and removing code.desktop from /usr/share/applications/mimelist.cache

EDIT
A more permanent solution i've found is the following.
add inode/directory=org.gnome.Nautilus.desktop to the ~/.local/share/applications/mimeapps.list file.
After doing this make sure to the inode/directory entry is the same or not present at all in ~/.local/share/applications/mimelist.cache' and /usr/share/applications/mimelist.cache

org.gnome.Nautilus.desktop can be replaced by your preferred file explorer if you don't use Nautilus.

You might need to restart your desktop environment for the changes to apply.

Finally found! it. I had to delete

inode/directory; /usr/share/code/code --new-window %s; test=test -n "$DISPLAY"

line in the /etc/mailcap file. Bingo!

Chromium related browsers seems to not respect xdg settings on not full-fledged Desktop environments like i3wm which I use. Because the problem was not reproducible when I logged in with xfce4 session.

The solution is simpler, What happens is that the system orders the directory opening preferences. Just go to the file manager > select a folder > right click > open with another application > select the file manager. This will update the opening preferences for the directories.

Related