After installing VS Code now my previous preferences have been overridden. I first noticed this morning when I tried to download an image from Viber that pcmanfm did not open like usual, but was in a hurry and did not pay much attention. To be honest I thought it was a Viber thing.
But now I tried to click a .zip file that I downloaded in Chrome, and instead of the xarchiver, VS Code was launched, which is not what I wanted to happen.
How can I restore these two? How can I explore for more overrides, instead for having to wait until I discover them?
You set/maintain your preference in ~/.config/mimeapps.list
I think mine did the same. But it was a long time ago and I’m unsure. As @linux-aarhus mentioned, the default applications are set in
~/.config/mimeapps.list. You only need to change that. I can’t remember what the catch-all wildcard for vscode was, but I removes the line containing it, and ever since it behaves itself.
The line should be similar to:
Those are my two associations.
Hope it helps!
Sorry, should have added that. I tried
cat ~/.config/mimeapps.list | grep -i code which did not yield any results.
This is the other way to do it all with cli in terminal, maybe it’ll help you get what you want, so in case you want to fix the
.zip extension, find a real .zip file on your disk and do the following…
xdg-mime query filetype ~/Downloads/vscode_rust_example.zip
This should give you the official mime type of that type of file, should be
application/zip in this case.
Then query what’s the default for that mime-type…
xdg-mime query default application/zip
…and you’ll get probably somehing like
code-oss.desktop (that’s for
code-OSS not sure for VSCode in AUR, probably just code.desktop).
Now, the desktop files are defined within the following directory (here I’m not sure if there exists equivalent in your $HOME but from my experience most desktop files are placed here)…
ls -ltrah /usr/share/applications/*.desktop
…and look for specific file that you’d want associated (back) with the zip, you’ll have to guess by the name of the app or some smarter method, it’s pretty cleaer most of the time.
And the last thing to do is to make an association (back to your favorite app, find it’s desktop file first within that dir)…
xdg-mime default your-zip-app.desktop application/zip
Thanks for the input.
I tried out your steps and
xdg-mime query default application/zip returned xarchiver.desktop actually, which was somewhat unexpected.
ls -ltrah /usr/share/appliations/*.desktop
returns a list of lines, and when I pipe that to
grep -i code
I get this:
-rw-r–r-- 1 root root 309 Jun 21 12:34 code-url-handler.desktop
-rw-r–r-- 1 root root 477 Jun 21 12:34 code.desktop
That said, I then remembered that there actually was/is an option in the context menu of the GUI to set the preferred applications for files extensions, which I used to reset zips to xarchiver and now it works great.
I still have an issue with Viber which I would like to troubleshoot further though. When I try to download a file from Viber (usually an image or a video), instead of the pcmanfm popup that used to come up, now a VS Code one is displayed, and that does not work at all.