Ubuntu – Custom icon for .desktop file not appearing

icons

I intend to change from Windows 7 to Ubuntu.

There are some icons on the desktop I would like to use on Ubuntu.

I converted these icons to *.png 64*64 pixel and put in /home/user/icons

Then I use the terminal:

sudo gedit

to:

[desktop entry]
Name=Account
Exec=/home/user/jameica/jameica.sh
Icon=/home/user/icons/ico_account.png
Terminal=false
Type=application

I store this file to /usr/share/application with the name account.desktop

The desktop entry is created, but not with the desired icon.

What is wrong?

Best Answer

As of July 2018, there seem to be some bugs in Unity in how it reads .desktop files. Specifically, the path provided for the Icon field cannot be wrapped in quotes. Even if the path contains spaces, it must not be wrapped in quotes.

On the other hand, it's worth mentioning here that the path provided for the Exec field must be wrapped in quotes if it contains spaces. If it doesn't contain spaces, the quotes can be left off. This inconsistency in behavior is horribly confusing and should really be considered a bug.

Thus, the following is a valid .desktop:

[Desktop Entry]
Name=Firefox Developer Edition
Comment=The developer edition of Firefox Quantum.
Exec="/home/jack/Applications/Firefox Developer Edition/firefox"
Icon=/home/jack/Applications/Firefox Developer Edition/browser/chrome/icons/default/default32.png
Terminal=false
Type=Application

The following will run, but not display the icon:

[Desktop Entry]
Name=Firefox Developer Edition
Comment=The developer edition of Firefox Quantum.
Exec="/home/jack/Applications/Firefox Developer Edition/firefox"
Icon="/home/jack/Applications/Firefox Developer Edition/browser/chrome/icons/default/default32.png"
Terminal=false
Type=Application

And the following won't even run:

[Desktop Entry]
Name=Firefox Developer Edition
Comment=The developer edition of Firefox Quantum.
Exec=/home/jack/Applications/Firefox Developer Edition/firefox
Icon=/home/jack/Applications/Firefox Developer Edition/browser/chrome/icons/default/default32.png
Terminal=false
Type=Application