Force Plasma to reread app icons

Plasma caches app (software) icons and the cache gets stale sometimes. Even when you re-add or change app icon to a new SVG, the old one is cached and used.

There is no GUI way to force Plasma to reread icons and with computers running for weeks, the cache gets stale soon.

rm -rf ~/.cache/icon-cache.kcache
rm -rf ~/.cache/ksycoca6*

helps, but this is CLI only.

Any other way to force KDE/Plasma to reread all icons and throw away stale caches? There should be such option in Settings panel, if not possible otherwise and systems is not smart enough to catch/spot such changes early.

Not quite what you’ve asked for but you could script it and add it to a cron job.

If there isn’t a bug report for the core issue you’re seeing of .desktop files not getting reread on update, that would be the best way to go - I imagine folks are, correctly, not going to want to implement a workaround for a bug instead of fixing it, so it may need a quality reproducible report.

2 Likes

Agreed with johnandmegh, this sounds like it’s really about .desktop files not being picked up rather than the icon cache itself in a lot of cases. Restarting plasmashell (kquitapp6 plasmashell && kstart plasmashell) sometimes forces a re-read without having to touch the cache files directly, worth trying before nuking the whole cache. But if it’s reproducible, a proper bug report would help way more than a workaround, since this trips up a lot of people packaging their own icon themes or apps.

It was about erasing cache. Once that was done, the icon was picked up and started to show properly.

The cache is already supposed to be regenerated when the system detects that an icon has changed. So clearly that’s not happening here, which means you’ve found either a bug in the system, or an oversight in its design that makes it not notice the way you’re changing the icons.

Or possibly you’ve discovered a very creative way to change the icons that isn’t advisable or supported! But we’ll never know without some more information. :slight_smile:

1 Like

Good to know that the cache gets regenerated. Not sure I can submit a bug at this stage, though. Hand edited SVG where background (fill) color was changed from #ffffff to none.

Rebuilding / repacking deb and reinstalling didn’t make Plasma/KDE to pick up the change. Changing icon manually (selecting a new file icon) at Plasma panel didn’t work either. Once caches were cleared via CLI, it updated.

Since the software identity (org.xxx), DEB version and the filename didn’t change, maybe there was no signal for Plasma to refresh.

This reminds me of an old exploit trick where the checksums on files may end up the same despite the contents being slightly different - like in your case changing the background. Regardless, the issue may come down to the logic KDE uses to detect whether the icon has changed, and whether that logic is flawed for most cases or whether your specific case is an outlier that requires a “trick” (like deleting the cache) to get it to work.

Sure, I agree. But even edge cases can be covered :slight_smile:

Doesnt kbuildsycoca6 fix this?

I presume OP has it installed already; it is run automatically when changes are detected but I think that’s where things are going wrong - in the detection of changes. I can’t replicate the issue though.

Actually, you are right, after deleting the caches I ran that.