3

I have searched this question online and got two approaches for it. First the terminal one: How to add Sublime text to dash

I'm getting an error sudo: sublime: command not found.

The next approach where I open terminal and type:

$ nautilus /usr/share/applications/

Here, I can't find the .desktop file for sublime text. I've looked on youtube too. But no luck. Someone please help.

3 Answers 3

0

Write subl instead of sublime.

sudo subl /usr/share/applications/sublime.desktop

1
  • Yes I did that. I no longer get the error 'sublime' command not found. Can you please also guide me on how to add sublime text desktop launcher? Nov 7, 2020 at 15:11
0

I am answering my own question. I navigated to the subl.desktop file in the following way:

Files->Other Locations->Computer->snap->sublime-text->current->meta->gui->subl.desktop

The entire path was "/snap/sublime-text/current/meta/gui"

Open subl.desktop file in any text-editor and edit it as follows:

[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=sublime-text.subl %U
Terminal=false
MimeType=text/plain;
Icon=/snap/sublime-text/current/opt/sublime_text/Icon/256x256/sublime-text.png    
Categories=TextEditor;Development;
StartupNotify=true
Actions=Window;Document;

[Desktop Action Window]
Name=New Window
Exec=/opt/sublime_text/sublime_text -n

[Desktop Action Document]
Name=New File
Exec=/opt/sublime_text/sublime_text --command new_file

Copy the file to Desktop and modify the properties as follows:

enter image description here

enter image description here

Then finally right click on this subl.desktop file and click "Allow Launching" option and that should be all for creating a desktop launcher for sublime text.

0
  1. Download the X86-64 version from https://www.sublimetext.com/download (to ensure you get the latest)
  2. Un-archive/tar to a directory of your choice.
  3. Create a desktop entry in /usr/share/applications
sudo vi /usr/share/applications/sublime.desktop
     
[Desktop Entry]
Version=3.2.2
Name=Sublime Text Editor
Comment=Nice
GenericName=Sublime
# Update with your local install location
Exec=/home/peter/apps/sublime/sublime_text
Icon=/home/peter/apps/sublime/Icon/32x32/sublime-text.png
Type=Application
Terminal=false
StartupNotify=true
Categories=GNOME;GTK;Development;
MimeType=text/plain;

Save and exit vi...

:wq

Done ;)

You must log in to answer this question.

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