0

So I've installed Sublime Text from "Ubuntu Software", and I can't open text files with it by default. Right click offers "Open with Other Application" and I can choose Sublime from there, but I have to do this every time.

I see tonnes of questions and replies about this, which involve editing ~/.config/mimeapps.list - but each entry points to .desktop files. And for the life of me I can't find a .desktop file for Sublime Text.

I typed "which subl" and got "/snap/bin/subl" Ah - it's a snap install. But then where is the desktop file for it located? It's not in ~/.local/share/applications or /usr/opt/applications. But it must exist somewhere, because it exists in the "Open with" menu, and I can run it from the application menu!

3 Answers 3

1

I'm not sure which you want but Main Menu (alacarte) says that the application menu is using /var/lib/snapd/desktop/applications/sublime-text_subl.desktop. Also (by searching for desktop in /snap/sublime-text/current) I discovered that subl.desktop is at /snap/sublime-text/current/meta/gui and sublime-text.desktop is at /snap/sublime-text/current/opt/sublime_text/sublime_text.desktop. Does that resolve your problem? Perhaps you could write your own answer with this information so that anyone who comes across this problem can use your full instructions to resolve it? :)

1
  • Thank you - I've actually book marked this page and am going to re-visit this soon and try out your ideas. I will certainly update this with my findings.
    – Domarius
    Nov 28, 2018 at 7:44
0

I solved this problem by copying the .desktop file from /var/lib/snapd/desktop/applications/ to ~/.local/share/applications (or /usr/share/applications) using the cp command. Then it will show up in the list of applications when you're choosing a default application through the normal means.

To have this happen automatically for all snap installations, you can create a link of /var/lib/snapd/desktop/applications/ in ~/.local/share/applications (or in /usr/share/applications) with ln -s /var/lib/snapd/desktop/applications/ ~/.local/share/applications/snap (the link is arbitrarily named snap here). (Credit to Louis Garczynski at Add a Snap Icon to the Desktop Ubuntu 16.04).

0

The way you can set snap applications as default for a certain file type is the same as for other apps. Open the "Properties" of the file. Set or change the Default Application on the "Open With" tab. Also your snap application will be listed in that dialog, under "Recommended Applications" or at least under "Other Applications".

The "Open with" choice in the right-click menu just serves that purpose: opening a file for a single time with an application that is different from the default. You cannot change the default application there.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .