PDA

View Full Version : [all variants] How can I add mapping to icon? (by name)



sam1948
August 18th, 2012, 07:13 AM
how can I add an icon to be familiar by its name?

for example in /usr/share/gcalculator.desktop
the icon is galculator (no full path to icon file)


ma@lap:/usr/share/applications$ cat galculator.desktop
[Desktop Entry]
Version=1.0
Name=Galculator
Comment=Perform simple and scientific calculations
Exec=galculator
Icon=galculator
Terminal=false
Type=Application
Categories=Utility;
StartupNotify=true
X-Ubuntu-Gettext-Domain=galculator

Marric
August 18th, 2012, 07:22 AM
This should help

Well, the essence of it is you copy the image to /usr/share/icons/hicolor, then the right size, then the right category - for instance, /usr/share/icons/hicolor/24x24/apps/ for a 24x24px icon for an application.

Then you create a .desktop file:

http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

And fill in the fields as appropriate, then copy to /usr/share/applications. You should now see the launcher etc. in the Unity dash, complete with icon. This should work in all desktops, not just Unity.

sam1948
August 18th, 2012, 07:35 AM
thank you but the icon was not found without its full path.

any other ideas?

Marric
August 18th, 2012, 07:37 AM
I guess you need to use the png format

sam1948
August 18th, 2012, 07:45 AM
I did and also did logout/login

Marric
August 18th, 2012, 08:11 AM
the right path is
/usr/share/pixmaps

MG&TL
August 18th, 2012, 08:30 PM
how can I add an icon to be familiar by its name?

for example in /usr/share/gcalculator.desktop
the icon is galculator (no full path to icon file)


ma@lap:/usr/share/applications$ cat galculator.desktop
[Desktop Entry]
Version=1.0
Name=Galculator
Comment=Perform simple and scientific calculations
Exec=galculator
Icon=galculator
Terminal=false
Type=Application
Categories=Utility;
StartupNotify=true
X-Ubuntu-Gettext-Domain=galculator



the right path is
/usr/share/pixmaps

The thread the quote from me is from is really embarassing. :lol:

The concept of the icon names is that the desktop implementation (i.e. GNOME, KDE, XFCE, LXDE, Unity, whatever) should follow the
icon spec (http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html) which says that it should look in a set few locations (namely ~/.icons, /usr/share/icons/hicolor/<size>/ and /usr/share/pixmaps) for icons by name. So, for instance, an icon named "firefox" might eventually be tracked down to /usr/share/pixmaps/firefox.png

So, essentially:

1. Make an icon, call it "appname.png".

2. Copy it to one of the locations specified in the link. An example might be /usr/share/icons/hicolor/24x24/appname.png

3. Set the icon field in your desktop file to "appname".

4. Depending upon your implementation, you might need to run:


gtk-update-icon-cache

or


gtk-update-icon-cache-3.0

to update the icon cache.

Hope that helps a bit.

sam1948
August 24th, 2012, 01:00 PM
thanks (: