Otaqui.com Blog

Unity Launcher for Sublime Text 2

If you’re using Ubuntu 11.10 Oneiric Ocelot, you might have noticed that it’s not straightforward to add custom launchers to the Unity Panel.

This is fine as long as you only ever install software using apt-get, aptitude or the a software manager GUI. With software that isn’t in any of the repositories though, you’re a little stuck – for example with Sublime Text 2.

There is an unofficial repository for ST2, but I have had some bad experiences with these so try and avoid them. I manually installed ST2 into /opt/sublimetext2 and added the following as /usr/share/applications/sublime_text.desktop:

[Desktop Entry]
Type=Application
Terminal=false
Name=Sublime Text 2
StartupNotify=true
GenericName=Text Editor
Comment=Edit text files
Exec=/opt/sublimetext-2/sublime_text %U
Icon=/opt/sublimetext-2/Icon/128x128/sublime_text.png
MimeType=text/plain;text/x-chdr;text/x-csrc;text/x-c++hdr;text/x-c++src;text/x-java;text/x-dsrc;text/x-pascal;text/x-perl;text/x-python;application/x-php;application/x-httpd-php3;application/x-httpd-php4;application/x-httpd-php5;application/xml;text/html;text/css;text/x-sql;text/x-diff;x-directory/normal;inode/directory;
Categories=GNOME;GTK;Utility;TextEditor;Application;Development;
Name[en_US]=Sublime Text 2
X-Ayatana-Desktop-Shortcuts=NewWindow;
[NewWindow Shortcut Group]
Name=New Editor Window
Exec=/opt/sublimetext-2/sublime_text --new-window
TargetEnvironment=Unity