How to add Sublime Text to Unity launcher

I am using Sublime Text to write this blog post. It is great piece of software. However, it is does not contain desktop file, so you need to create it separately.

Desktop file

Create desktop entry file and store it as ~/.local/share/sublime_text.desktop.

[Desktop Entry]
Name=Sublime Text
GenericName=Text Editor
Comment=Edit text files
Exec=/opt/sublime_text/sublime_text %U
Terminal=false
Type=Application
MimeType=text/plain;
Icon=/opt/sublime_text/Icon/48x48/sublime-text.png
Categories=Utility;TextEditor;
Keywords=Text;Editor;

Use desktop-file-validate command to validate its contents.

Unity launcher

Add above-mentioned desktop entry file to the Unity launcher. You can do this by hand (drag file to launcher) or just execute following command.

$ gsettings set com.canonical.Unity.Launcher favorites \
  "$(gsettings get com.canonical.Unity.Launcher favorites | \
     sed "s|\]|,'application://sublime_text.desktop'&|")"

References

Milosz Galazka's Picture

About Milosz Galazka

Milosz is a Linux Foundation Certified Engineer working for a successful Polish company as a system administrator and a long time supporter of Free Software Foundation and Debian operating system.

Gdansk, Poland https://sleeplessbeastie.eu