Can't add Sublime Text to the Gnome Shell Dock

I've downloaded Sublime Text for Linux (32bit) and put it in /opt, linked it in /usr/bin and currently I can start it by typing sublime_text in console. Whenever I start it its icon appears in the Shell's Dock but I can't pin it, and it doesn't appear in the Applications menu either.

How do I add it?


The shortest way:

  1. Press Super to activate overview.
  2. Type main menu and hit Enter
  3. Add new item, where the command is sublime_text.
  4. Voila, you have your shortcut.

I installed Sublime Text 3 from Webupd8 PPA, and the .desktop file was already created.

But I was still not able to pin the icon to Gnome Shell dock when the app is launched.

For those who are in the same situation, you can pin it from the dashboard search directly, without launching it.

Just open the dashboard with the Super key, search for Sublime, right click on the icon, then select Add to Favorites.


You have several options to make this happen. The crux of it is that in order for an app to be usable by GNOME Shell, it needs to have a corresponding .desktop file in either /usr/share/applications or ~/.local/usr/share/applications.

Either:

  • Use alacarte (the old GNOME menu editor) to add a new menu item
  • Use the command gnome-desktop-item-edit ~/.local/usr/share/applications/sublime-text.desktop, which will pop a dialog asking for the information required for the shortcut, the same as alacarte does
  • Add a file into one of those directories yourself, using the same format as other .desktop files

The layout for a desktop file is of the form:

#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_GB]=gnome-panel-launcher
Name[en_GB]=Sublime Text 2
Exec=sublime-text
Comment[en_GB]=Sublime Text 2
Name=Sublime Text 2
Comment=Sublime Text 2
Icon=gnome-panel-launcher

I've just resolved this issue just playing around a little bit.

In my case I believe I've downloaded Sublime from their website. It downloaded a folder with all the program and it already came with a sublime_text.desktop.

When I looked at their properties, i went to the Permission tab (2nd one, my ubuntu is in Spanish "Permisos") and checked the last option that says something like "Allow to execute this file as a program".

As soon as i checked that and close the properties, the icon changed to the Sublime one, dissapeared the ".desktop" from the name, and I could execute the program with that file, which I can keep in the dock.

Hope it helps to someone.

PD: sorry for my bad english :P