6

My goal is to create a working launcher for PHPStorm which will work in both the desktop and the Unity launcher, using the proper logo, in 12.04. I followed the instructions here - How can I create launchers on my desktop? - to create a launcher on the desktop using the Gnome dialog box. That worked a treat as far as the desktop was concerned, but dragging the icon to the Unity launcher gave it a weird icon:

enter image description here

The PHPStorm.desktop file looks like this:

#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_GB]=gnome-panel-launcher
Name[en_GB]=PHPStorm
Exec=/home/shane/Software/PhpStorm-4.0.1/bin/phpstorm.sh
Comment[en_GB]=PHStorm
Name=PHPStorm
Comment=PHStorm
Icon=/home/shane/Software/PhpStorm-4.0.1/bin/webide.png

Next I tried to follow the accepted answer from here: How can I change the icon of an application in the Unity launcher?, but I found that there was no icons folder in ~/.local/share/. I went ahead and created it, and the rest of the folders mentioned in the answer, ~/.local/share/icons/hicolor/16x16/ etc. I then created a phpstorm.png in each folder, at the required sizes.

Next, I edited my PHPStorm.desktop file to the following and copied it to ~/.local/share/applications/

#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_GB]=phpstorm
Name[en_GB]=PHPStorm
Exec=/home/shane/Software/PhpStorm-4.0.1/bin/phpstorm.sh
Comment[en_GB]=PHPStorm
Name=PHPStorm
Comment=PHPStorm
Icon=phpstorm
#Icon=/home/shane/Software/PhpStorm-4.0.1/bin/webide.png

After logging back in, my unity launcher icon had disappeared completely, and the icon on my desktop had turned white.

What have I done wrong here? Why aren't the icons being picked up from the icons folder, and is the initial lack of icons folder something I should be concerned about?

3 Answers3

8

I just created this wiki page :) https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles

hytromo
  • 4,904
7

Regarding the icons folder

The only program that has icons in ~/.local/share/icons is Wine, so no, a default install shouldn't create the folder.

Most installed programs place their icons in /usr/share/icons, where all users can access them.

Regarding the .desktop file

I went ahead and created it, and the rest of the folders mentioned in the answer, ~/.local/share/icons/hicolor/16x16/ etc.

The icon has to be placed in a folder called ~/.local/share/icons/hicolor/16x16/apps/.

Dennis
  • 1,839
7

I personally prefer adding icons to launcher by first adding applications to unity dash:

  1. Install Main Menu via Ubuntu Software Center.
  2. Open dash and type "Main Menu".
  3. Open menu editor and add your application to proper category (set name, icon, command etc).
  4. Save and exit.
  5. Open dash again type application name and run it.
  6. Right-click on icon of your application in launcher and check that you want hold it in launcher.

Now you have application in launcher and also in dash :)

Geoffrey
  • 578
piotrekkr
  • 513
  • 1
  • 5
  • 14