6

I am working on a package for a custom application and cannot get my applications icons to display. Here is my desktop file, which is installed in /usr/share/applications:

[Desktop Entry]
Version=1.0
Type=Application
Name=Map Creator
Icon=ntfmo-map-creator
TryExec=/opt/ntfmo/map_creator/bin/map_creator
Exec=/opt/ntfmo/map_creator/bin/map_creator.sh
Categories=Office;
X-Desktop-File-Install-Version=0.16

I have copied images to the following locations:

  • /usr/share/icons/hicolor/32x32/apps/ntfmo-map-creator.png
  • /usr/share/icons/hicolor/48x48/apps/ntfmo-map-creator.png
  • /usr/share/icons/hicolor/scalable/apps/ntfmo-map-creator.svg

I have rebooted, but still nothing. Do you have to register the icons or something?

[EDIT] Ok, I got it to work by running sudo rm -f /usr/share/icons/*/icon-theme.cache, but that seems a little draconian. Is that the "correct" solution? Does my package need to run that after it installs? Seems a little much....

11

Add gtk-update-icon-cache /usr/share/icons/hicolor to your debian/postinst file:

#!/bin/sh

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

exit 0
  • OK, thanks, this is working. Although I also noticed that ubuntu automatically updates the cache when icons are added as part of a package, but not when you manually drop them in. – Dave Oct 5 '11 at 12:35
  • gtk-update-icon-cache checks the timestamp on the top-level icon directory, so you also need to touch that. The only documentation I can find for this is here: fedoraproject.org/wiki/Packaging:Scriptlets#Icon_Cache – Brendan Long Feb 18 '17 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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