How to add Sublime text to dash

  1. Open Terminal and write this command

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

    This will create a file name sublime.desktop in the user/share/applications/ folder and open it for you.

  2. Copy paste the following content in it and save the file

    [Desktop Entry]
    Version=1.0
    Name=Sublime Text 2
    *#Only KDE 4 seems to use GenericName, so we reuse the KDE strings.*
    *#From Ubuntu's language-pack-kde-XX-base packages, version 9.04-20090413.*
    GenericName=Text Editor 
    Exec=sublime
    Terminal=false
    Icon=/usr/lib/Sublime Text 2/Icon/48x48/sublime_text.png
    Type=Application
    Categories=TextEditor;IDE;Development
    X-Ayatana-Desktop-Shortcuts=NewWindow
    [NewWindow Shortcut Group]
    Name=New Window
    Exec=sublime -n
    TargetEnvironment=Unity
    
  3. You will see the Sublime-Text icon in the dash-board. right click the icon and click

    Lock in Launcher


STEP 1

Download the tarfile that suits you best and extract it. Here’s the command to extract tar.bz2 files:

tar xf Sublime\ Text\ 2.0.1\ x64.tar.bz2

You’ll notice that I got the 64-bit version. The reason is that it’s lightning fast. So, go for that if you can!

STEP 2

You’ll get a “Sublime Text 2″ folder after extraction. This folder contains all the files that Sublime Text will need. So we have to move that folder somewhere more appropriate. Like the “/opt/” folder :

sudo mv Sublime\ Text\ 2 /opt/

STEP 3

At some point you’d want to be able to call Sublime Text from the Terminal by just typing “sublime”. To do that, we’ll just create a symbolic link in “/usr/bin” like thus:

sudo ln -s /opt/Sublime\ Text\ 2/sublime_text /usr/bin/sublime

STEP 4

Now that our files are at the right place, we need to create a launcher in Unity. To do this, we’re going to create a .desktop file in “/usr/share/applications”:

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

And paste the following content:

[Desktop Entry]
Version=1.0
Name=Sublime Text 2
# Only KDE 4 seems to use GenericName, so we reuse the KDE strings.
# From Ubuntu's language-pack-kde-XX-base packages, version 9.04-20090413.
GenericName=Text Editor

Exec=sublime
Terminal=false
Icon=/opt/Sublime Text 2/Icon/48x48/sublime_text.png
Type=Application
Categories=TextEditor;IDE;Development
X-Ayatana-Desktop-Shortcuts=NewWindow

[NewWindow Shortcut Group]
Name=New Window
Exec=sublime -n
TargetEnvironment=Unity

As you can see, these lines are quite straightforward. Go ahead and experiment a bit with them.

STEP 5

Now you would probably want to open all text files with Sublime Text 2. The easiest way to do that is to open up the file associations list:

sudo sublime /usr/share/applications/defaults.list

And replace all occurrences of gedit.desktop with sublime.desktop. Tada ! There you go. You now have Sublime Text 2 installed on Unity on Ubuntu 12.04, like a pro.

Source: http://www.technoreply.com/how-to-install-sublime-text-2-on-ubuntu-12-04-unity/


This is the simplest way to add Sublime Text 2 to the Unity launcher. Open a terminal and type:

gnome-desktop-item-edit ~/.local/share/applications/ --create-new

Fill out the fields in the form and click OK. You can now find Sublime Text 2 in all the same locations as the other installed applications on your computer. When you launch Sublime Text 2, right click its icon and "Lock To Launcher".


Note: The application shortcut will only be visible for your current user. If this unacceptable, change ~/.local/share/applications/ to /usr/share/applications/ and add sudo to the start of the command.