Ubuntu – Custom application icons not displaying

icons

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/32×32/apps/ntfmo-map-creator.png
  • /usr/share/icons/hicolor/48×48/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….

Best Answer

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
Related Question