Categories
SysOps

How to add Sublime Text to Unity launcher

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

Desktop file

Create a 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 the above-mentioned desktop entry file to the Unity launcher. You can do this by hand (drag file to the launcher) or just execute the following command.

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

References