Change application icon in Unity launcher

Asked by BigBadWoofer

Just updated to 12.04 LTS. So far, so good. However, some minor probllems.

I think Unity picked up info from my .gconf file from my home directory (untouched by the install since it was on another device). Unity launcher shows two icons to run the Gnucash application with different data files. I installed the application from the Ubuntu Software Center. Clicking on the icon in the launcher runs the application fine, selecting the right data file even.

The problem is that the image used in the launcher icons for the application looks like a gray piece of paper with a question mark on it. How do I get Unity to use an icon image of my choice so I can tell which is which. The title for the icon matches the name of the shortcut I have on my desktop but didnt use the image used by the shortcut. I've tried unlocking the icon and running the program from the desktop shortcut. It builds a new icon in the launcher but the same dirty gray image.

So is there a way to chose the image that's shown in a launcher icon?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu unity Edit question
Assignee:
No assignee Edit question
Solved by:
BigBadWoofer
Solved:
Last query:
Last reply:
Revision history for this message
Sam_ (and-sam) said :
#1

Search the .desktop file of the application in ~/.local/share/applications, for system wide it's /usr/share/applications.
Open it with gedit, for example:
gedit ~/.local/share/applications/gnucash.desktop
or
sudo gedit /usr/share/applications/gnucash.desktop

When there is a line saying 'Icon' enter the path to your custom icon and save the edited file. (in case logout-in)
Icon=<path_of_custom_icon>

An example of a .desktop file.
http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.0.html#example

System wide icons are in /usr/share/icons, custom icons from user are in ~/.icons

Revision history for this message
BigBadWoofer (cericson46) said :
#2

Nothing in .local/share/applications, but found /usr/share/applications/gnucash.desktop

Edited the Icon line with an absolute path to an image provided in /usr/share/gnucash/pixmaps

Found no way to reset Unity so rebooted.

No change. Launcher icon is still the same gray paper with question mark.

Is there a specific size image that should be used? Used 64x64 pixel image.

Revision history for this message
Sam_ (and-sam) said :
#3

When there is no change then it was the wrong .desktop file, there has to be another one linked together with the question mark icon.
If there is nothing in ~/.local/share/applications find out with dconf-editor.
Please open a terminal: ctrl+alt+t
Install dconf-tools:
sudo apt-get install dconf-tools

Then: alt+f2, run dconf-editor.
Go to
desktop.unity.launcher
Look at favorites which apps have their icons in launcher presented.

However, if clicking on one of those gnucash icons opens the app fine then just remove the other.

Revision history for this message
BigBadWoofer (cericson46) said :
#4

Installed and ran dconf-editor

desktop.unity.launcher showed:
['nautilus-home.desktop', 'firefox.desktop', 'thunderbird.desktop', '/home/chuck/Desktop/Accounting - Home.desktop', '/home/chuck/Desktop/Accounting - Business.desktop', 'gnome-control-center.desktop', 'ubuntu-software-center.desktop', 'gnome-terminal.desktop', 'libreoffice-writer.desktop', 'libreoffice-calc.desktop', 'libreoffice-impress.desktop', '/home/chuck/.gnome2/panel2.d/default/launchers/backup_finances.sh-1.desktop', 'tomboy.desktop', 'rhythmbox.desktop', 'gnome-system-monitor.desktop']

/home/chuck/Desktop/Accounting - Home.desktop showed:
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_US]=gnome-panel-launcher
Name[en_US]=Home
Exec=gnucash /home/chuck/Finances/Home
Comment[en_US]=Accounting Package on Home accounts
Name=Accounting - Home
Comment=Accounting Package on Home accounts
Icon=/home/chuck/.gnucash/gnucash-icon.png

ls -l /home/chuck/.gnucash/gnucash-icon.png
-rw-r--r-- 1 chuck chuck 3826 Jun 23 2006 /home/chuck/.gnucash/gnucash-icon.png

That is the image used by the shortcut on the desktop too. The image is 48x48 pixels.

Would it make any difference if I changed to another .png in /usr/share?

Revision history for this message
Sam_ (and-sam) said :
#5

As you can see yourself the 'Accounting' Home.desktop has a generic icon entry:
Icon[en_US]=gnome-panel-launcher

instead of
Icon[en_US]=/home/chuck/.gnucash/gnucash-icon.png

dconf-editor displays two 'Accounting' .desktop files in launcher favorites.
'/home/chuck/Desktop/Accounting - Home.desktop'
'/home/chuck/Desktop/Accounting - Business.desktop'

Rather verify above .desktop files regarding which icon they have.

> Unity picked up info from my .gconf file

Could be this one.
'/home/chuck/.gnome2/panel2.d/default/launchers/backup_finances.sh-1.desktop'

Maybe picked from gconf but irrelevant when running Unity since there is no gnome-panel.
When not running Gnome in classic mode the whole directory is irrelevant.
.gnome2/panel2.d/default/launchers
Although not sure if it would make any difference in classic mode since Gnome2 is dead anyway.

Revision history for this message
BigBadWoofer (cericson46) said :
#6

> Could be this one.
'/home/chuck/.gnome2/panel2.d/default/launchers/backup_finances.sh-1.desktop'

That is an script to backup the finances files. It is an entirely separate shortcut.

However, I did solve my issue. "icon[en_US]" is the image used in the launcher. "icon" is the image used on the shortcut on the desktop. Setting both to the image file did what I wanted.

There is a document someplace that explains the items in the .desktop file. I ran across it and now can't file it again.

Revision history for this message
Sam_ (and-sam) said :
#7

> There is a document someplace that explains the items in the .desktop file.

The specifications of .desktop files are linked in #1.