Application Switcher Caches Application Icons

I am developing an application and yesterday I decided to replace the default icon with an appropriate icon. Everything seemed to work, except for the fact that it didn't work in the Application Switcher. When I saw that I didn't realize at that time that the Application Switcher is provided by KM.

At some point I did realize that and decided to kill KM completely. And voila the icon was assigned to the application. For me this was a learning that costed me like 4 hours of trying and searching for possible causes and fixes. This reason was not mentioned anywhere, hence this post.

I am considering this a minor bug although I do understand why the application is caching these icons.

@peternlewis?

Yes, Keyboard Maestro caches the application icons on launch. Caching the icons takes quite a while, and not having them cached is a serious performance hit. There is actually quite a lot of code dedicated to caching the application icons.

It is extremely rare for application icons to change, and the system provides no support for indicating when an application icon might have changed, so Keyboard Maestro makes no attempt to deal with changes to application icons.

1 Like

Understood. As I said, I can understand why this will not be supported. I was posting it more to raise awareness than that I expected this to be fixed. Appreciate the feedback though.

1 Like

Hi Peter

It is extremely rare for application icons to change

From the Appearance tab in the settings of OmniFocus 4…

Perhaps it will start to become less rare? In the meantime, is there a location of Keyboard Maestro's icon cache in the file system, that can be deleted to force a cache rebuild? (restarting KM Engine hasn't done the trick for me)

Cheers

Just to overstate my point…

Whilst I find this kind of discrepancy hard to ignore, obviously not enough to change back to the default OF4 icon :slight_smile: (whose colours are too similar to Obsidian to avoid regular selection error — PEBKAC — while switching apps)

Keyboard Maestro caches the icon of the application the first time it is referenced.

It does this using the NSWorkspace iconForFile API. So the likely issue is that API is doing its own caching (or maybe not paying attention to however the application is changing its icon).

Ah okay, I understand. Thanks for the clarification.

In fact, you gave me the clue to a workaround I'm happy with… Copying the icon I wanted, and pasting it over the OF4's app icon in the Finder's Get Info window seemed to trigger a cache refresh, and after restarting Keyboard Maestro Engine I'm getting the icon I want in KM's app switcher.

:+1:

1 Like