A much easier method is to try the public beta version, as it comes in both tarball form for any Linux version, and in a .deb
format specifically for Ubuntu. Download either 32- or 64-bit, depending on your version of Ubuntu (run uname -a
at the command line, and look for either i386
(32-bit) or x86_64
(64-bit) in the output), then at the command line navigate to where you downloaded it and run
sudo dpkg -i sublime-text_build-XXXX_YYYY.deb
where XXXX
is the build number (currently 3059) and YYYY
is either i386
or amd64
. This will automatically install Sublime Text in /opt/sublime-text
, create a /usr/bin/subl
command, and automatically create /usr/share/applications/sublime_text.desktop
along with the associated icons. It should also create a launcher in your Unity taskbar.
Sublime Text 3 is the future of the editor, and every day more and more plugins and extensions are released or revised on Package Control that are compatible with ST3. If you purchase a license, which is required for long-term use after evaluation, you will also have access to the bleeding edge development releases which are released more frequently than the public beta versions and so are more up-to-date as far as new features and bug fixes are concerned. Sublime Text 2 is basically a finished product as far as development is concerned, and while it is quite stable for most people, many plugins do not work with it, especially those under active development that depend on some of the advanced features that ST3 provides.
It's worth noting that ST2 and ST3 can coexist peacefully on the same system, as the plugins and data are stored separately. You obviously can't have two subl
commands, but you can rename one of them subl2
or subl3
, for example.
If you still need to create a .desktop
file for ST2, its contents should be as follows. Please note that it assumes you moved the Sublime Text 2
directory from where you unpacked it to /opt/sublime_text_2
. If this is not the case, please update the directory paths accordingly.
[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text 2
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=/opt/sublime_text_2/sublime_text %F
Terminal=false
MimeType=text/plain;
Icon=/opt/sublime_text_2/Icon/48x48/sublime_text.png
Categories=TextEditor;Development;
StartupNotify=true
Actions=Window;Document;
[Desktop Action Window]
Name=New Window
Exec=/opt/sublime_text_2/sublime_text -n
OnlyShowIn=Unity;
[Desktop Action Document]
Name=New File
Exec=/opt/sublime_text_2/sublime_text --command new_file
OnlyShowIn=Unity;
Save the file as sublime.desktop
, then use sudo
to move it to /usr/share/applications
. You may have to log out and then back in, but it should now be available in Unity.
Good luck, and if you have any questions please let me know.
If you take a good look in Dash, you will find out that matlab.desktop
does not appear as an application, but the file matlab.desktop
appears in search, or recently used, since you obviously edited it.
The error
The reason is that Dash does not see it as a valid .desktop
file for (at least) the following reason:
- You should not use relative paths in a
.desktop
file (Desktop/Programs/scripts/runMatlab.sh
is relative), but absolute paths.
Other possible reasons could be an invalid icon path or the fact that you call the script without the preceding sh
(if the script is not executable, but given the other information in your question, that seems not to be the case).
Notes
Another thing is that if you store the script on what appears to be a local directory, you should not store the .desktop
file in /usr/share/applications
, but in ~/.local/share/applications
.
There is no need to make a .desktop
file executable if you run it from Dash or the Launcher. Most launchers in either /usr/share/applications
or ~/.local/share/applications
are not. Only if you locate it on- and run it from your Desktop.
Best Answer
I just ran into the same problem that you did. I messed around with a bunch of settings within my .desktop files to try to get the name to show up in the Unity launcher, since I had created the .desktop files in ~/Desktop then moved them to ~/.local/share/applications
All I had to do to get the Unity application launcher to show the names is log out of Ubuntu and log back in. Pretty lame, I know, but it worked.
At least this shows that in my case (and probably yours too) the .desktop files were not somehow wrong. After all, in my case, the desktop-file-validate program didn't list any errors. There was probably some name cache within Unity that needed to be cleared. It would be more satisfying to know how to do that without logging out, but this workaround is good enough for me for now. Hope this observation helps someone else!