Nightly icon cache update for Gnome

Sometimes it happened on my Ubuntu system, that a newly added application didn't had its icon.
This can happen due to an not updated icon cache of GTK.
This can be fixed with the command
gtk-update-icon-cache
, which rebuilds the GTK+ icon cache.

So why don't do this automatically in the background on a daily basis (during the night)?

Install instructions

Just execute the following commands, which will put a script into /etc/cron.daily so that the cache is fixed and the missing icon appears overnight.
sudo -i
echo '#!/bin/sh
#
# 

for theme in $(find /usr/share/icons -mindepth 1 -maxdepth 1 -type d)
do 
    if [ -f "$theme/index.theme" ]
    then gtk-update-icon-cache -f -q "$theme"
    fi
done

exit 0' > /etc/cron.daily/update-icon-cache
chmod a+x /etc/cron.daily/update-icon-cache

No comments:

Post a Comment