Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a .deb package that installs application icons under the following locations:

/usr/share/icons/hicolor/16x16/apps/
/usr/share/icons/hicolor/48x48/apps/
/usr/share/icons/hicolor/32x32/apps/
/usr/share/pixmaps/

After I installed the .deb package and replaced the installed icons with new ones (on disk), the old icon still shows up in Unity. What icon does Unity use for the application?

share|improve this question
    
It looks like this question is not accurate. The icon used in the Dash is different from the one used for the Launcher Item. When you open the Dash to start an application, Ubuntu uses one of the icons mentioned in the question but when the application is displayed in the Launcher (Launcher Item) then that icon is the icon associated with the application. In my case, I'm running a Java application so it's the icon I set using JFrame#setIconImage(Image). –  Nicu Oct 27 '11 at 4:49
    
Can someone tell me what's the best way to handle the answer to this question considering that it wasn't accurate? Should I post my own answer and accept it? Should I award the bounty to @fossfreedom since he answered the first part of the question (dash icons) and not the second part (launcher item icon) which is what I actually wanted to fix and I figured out after I asked the question? –  Nicu Oct 27 '11 at 4:55
    
That choice is entirely up-to you - if you think the best answer is yours - post it and accept it. As to the bounty - again up-to-you. As per the FAQ - the bounty cannot be reclaimed by yourself :( meta.stackexchange.com/questions/16065/… –  fossfreedom Oct 27 '11 at 10:03
    
Thanks @fossfreedom. I've awarded you the bounty and answered my own question. –  Nicu Oct 28 '11 at 5:25

4 Answers 4

Icons are cached in one very big file:

GTK+ can use the cache files created by gtk-update-icon-cache to avoid a lot of system call and disk seek overhead when the application starts. Since the format of the cache files allows them to be mmap()ed shared between multiple applications, the overall memory consumption is reduced as well.

Every theme should create a cache file on installation.

/usr/share/icons/[theme]/icon-theme.cache

So for example - if you remove/rename the gnome icon-cache file:

sudo mv /usr/share/icons/gnome/icon-theme.cache /usr/share/icons/gnome/icon-theme.cache.backup

You can then regenerate the cache:

sudo gtk-update-icon-cache --force /usr/share/icons/gnome

In your case, you have added your application icons to hicolor - therefore you should force the regeneration of this cache file to pick up the new icons:

sudo gtk-update-icon-cache --force /usr/share/icons/hicolor

source

share|improve this answer
    
Installing packages that need the icon cache to be regenerated usually employ some apt/dpkg hooks. Hence it is possibly not the debian way to put a gtk-update-icon-cache into a postinst script. –  aquaherd Oct 26 '11 at 21:04
up vote 1 down vote accepted

When I first asked the question I didn't know that the icon used in the Dash is different from the one used for the Launcher Item. I assumed Unity only uses icons from /usr/share/icons/hicolor/*/apps/ or /usr/share/pixmaps/ since that's where I installed all the icons but I was wrong.

When you open the Dash to start an application, Ubuntu uses one of the icons mentioned in the question but when the application is displayed in the Launcher (as a Launcher Item) then its icon is the icon of the application. In my case, I'm running a Java application so it's the icon I set using JFrame#setIconImage(Image).

I was using a 16x16 pixel icon which looked blurry in the Launcher. Now, I'm using a 64x64 pixel icon and it looks much better.

share|improve this answer
    
+1 good answer - well done –  fossfreedom Oct 28 '11 at 8:22

For most uses the icon is what is specified the the apps .desktop on the Icon= line. Typically these .desktops are in /usr/share/applications & can be opened in a text editor (though not 'normally' from the context menu) or check it's properties for a remedial way to edit if need be. An editor is best.

If referring to a systray icon that's set elsewhere, in ?binary? maybe.

share|improve this answer
    
I also have a .desktop file that specifies the icon and it's installed in usr/share/applications. However, my problem is not that it doesn't find the icon. My problem is that although there is no trace of the original icons because I replace them with something else, Unity still uses one of them. So the question is which one and where does it cache it? –  Nicu Oct 24 '11 at 18:12
    
Did you restart Unity after replacing them? These icons will be cached so you don't have to read from disk every time you open the lens. That means even if you delete them from disk, they'll be present in memory. –  Jo-Erlend Schinstad Oct 26 '11 at 22:51
    
I think I did and if I remember well the old icons were still used by Unity but today when I logged in again, the new icons showed up in the Dash. I didn't do anything to update the cache, Unity just used the new icons in the Dash but not for the Launcher Item. See my comments to the question for more details. –  Nicu Oct 27 '11 at 4:59

The mime-type association of an icon should be the icon of the app that opens it. But ubuntu 12.04 changed it. Now,each mime-type comes with its own icon specified in /usr/share/icons/gnome/scalabe. The most irritating one is there are hundreds of file extensions that now come under text generic mime-type. It seems there is no way to change these. For example, see the question by Sunita. She wants a special icon for only tex files out of all text type files. She is unable to do it. Imagine, if the icon of the opening app would be displayed for tex files, in her case, she would find all tex files show the `kile' icon in icon view of the files. (Assuming she uses kile to open tex files). Any work around? To associate all tex files to a special icon leaving all other mime-type files under text category?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.