3

After installing Sublime Text 3 .deb file the package description said something along the lines of "This is to be run on the terminal". So I said to myself, "No problemo Sublime, I will create a .desktop file for you... Huh?"

As it appears, Sublime Text already has a .desktop file in /usr/share/applications but I do not understand why Dash can't see it when searching?

[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=/opt/sublime_text/sublime_text %F
Terminal=false
MimeType=text/plain;
Icon=sublime-text
Categories=TextEditor;Development;
StartupNotify=true
Actions=Window;Document;

[Desktop Action Window]
Name=New Window
Exec=/opt/sublime_text/sublime_text -n
OnlyShowIn=Unity;

[Desktop Action Document]
Name=New File
Exec=/opt/sublime_text/sublime_text --command new_file
OnlyShowIn=Unity;

Did I mention I'm a Linux noob?

  • I had this issue as well. Can't remember how I fixed it though. Let me check my .desktop and see if I can recall what I did. – Android Dev Apr 5 '16 at 1:54
  • @AndroidDev That would be most helpful. Thanks Dev. – cnic Apr 5 '16 at 2:08
  • I have Ubuntu in a dual boot with Windows 7, and unfortunately I can't reboot at the moment since I'm rendering a video in Win7, so I'll get back to you tomorrow. – Android Dev Apr 5 '16 at 2:11
  • @AndroidDev Alright, no worries. – cnic Apr 5 '16 at 2:15
  • Hi cnic, you probably (well, actually certainly) have a sublime .desktop file in ~/.local/share/applications. Remove it, log out and back in, for the local one will always overrule the global one. – Jacob Vlijm Apr 5 '16 at 4:55
5

What to do if an application does not show up in Dash, or cannot be launched from Dash after you installed it?

It can happen that you installed an application, you are sure the application is represented by a .desktop file in /usr/share/applications, but it either does not show up or the icon in the launcher doesn't do what it is supposed to do.

  1. Log out and back in
    Although an application should show up immediately after installation, incidentally, new .desktop files are not found immediately. Logging out and back in makes sure Unity is forced to re- read the directories ~/.local/share/applications and /usr/share/applications for valid launchers.
  2. Test- check the global desktop file
    If that does not solve the issue, browse to /usr/share/applications and drag the corresponding .desktop file on to the launcher and click on it.
    If the application is launched correctly, you can be pretty sure you have a local .desktop file, representing the application, in ~/.local/share/applications. Since local .desktop files overrule their global version, the local one is most likely incorrect or outdated.
    To find it, open a terminal and run:

    grep -iR <application> ~/.local/share/applications/
    

    where <application> is (of course) the name of the application.

    Remove possible local versions, log out and back in.

    If the application does not launch correctly, your global .desktop file is incorrect, which is highly unlikely, but if so, it can have several causes.

Explanation

If you have duplicated launchers (.desktop files), representing the same application, Unity picks the local one on log in. During a session, this does not change normally, unless you force Unity to use a specific launcher by dragging it on to the Unity Launcher.

This is usually the fastest and most reliable way to both check the validity of the global .desktop file, and detect the existence of local versions, rather then digging through ~/.local/share/applications.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.