Why do portable app icons disappear from Unity launcher after restart?

I downloaded SublimeText and placed it in my home folder. I locked sublimetext to the Unity launcher, but when I restart my PC the icon disappears from the launcher.

Why is this happening? Can I solve this somehow?

Answer

A .desktop file is needed. One way is to install sublime text editor via webupd8 ppa.

Version 3 (url):

sudo add-apt-repository ppa:webupd8team/sublime-text-3 
sudo apt-get update
sudo apt-get install sublime-text-installer

Version 2 (url, not tested, but should work):

sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text

This adds a .desktop file to /usr/share/applications/.

Alternatively, add a .desktop file to $HOME/.local/share/applications/ manually. This should point to your binary.

This is the .desktop file from version 3 on my system:

# cat /usr/share/applications/sublime-text.desktop 
[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;Utility;
StartupNotify=true
Actions=Window;Document;

X-Desktop-File-Install-Version=0.22

[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;

Attribution
Source : Link , Question Author : lacexd , Answer Author : setempler

Leave a Comment