Ubuntu – 18.04 custom icon from .desktop file not populating in dock

18.04desktopgnome-shelliconsubuntu-dock

I can't seem to get the proper icon to display on 18.04 dock using this custom launcher. The icon does display correctly along with the application name using the "Files" application. If I double click on the icon in the "Files" folder the application loads up no problem. I can then add it to dock favorites but dock uses some generic icon.

Where did I mess up the contents of the .desktop file listed below?:

[Desktop Entry]
Encoding=UTF-8
Version=1.1
Type=Application
Name=Songsheet Generator
Icon=/home/hgh/BIN/songsheet.png
Path=/home/hgh/BIN
Exec=java -jar SG02.jar
StartupNotify=false
StartupWMClass=com-tenbyten-SG02-SG02App
OnlyShowIn=Unity;
X-UnityGenerated=true
Actions=My-Custom-Action;
GenericName[en_US.UTF-8]=Songsheet Generator
Comment[en_US.UTF-8]=Guitar tab editing software
[Desktop Action My-Custom-Action]
Name=Name of the Option
Icon=songsheet.png
Exec=java -jar /home/hgh/BIN/SG02.jar

Best Answer

[Desktop Action My-Custom-Action]
Name=Name of the Option
Icon=songsheet.png
Exec=java -jar /home/hgh/BIN/SG02.jar

"Icon" should specify a full path to the image

I've never seen this type of entry in a .desktop file and I've created and edited quite a few of them. I'm not saying that you're wrong. Also, there's no need for the "StartupWMClass" entry or even specifying locale as in your "GenericName[en_US.UTF-8]" entry and your "Comment[en_US.UTF-8]" entry ( just remove [en_US.UTF-8] ), unless you're planning on packaging your application for installation on another user's computer.

I see the "Categories" entry is missing, although I'm not entirely sure it's needed. It's used by the system when generating entries for the Open With... dialog and possibly when generating menu items for the Applications button on the desktop.

Other than that, everything else looks OK to me.

Related Question