beeware / briefcase

Tools to support converting a Python project into a standalone native application.
https://briefcase.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
2.48k stars 353 forks source link

Ensure macOS apps pick up new icons after an update #1766

Closed freakboy3742 closed 2 months ago

freakboy3742 commented 2 months ago

With the switch to Toga using the binary's icon at runtime, a new bug emerges - macOS caches app icons. When using the app template, and you change the app icon, the app bundle on the filesystem will be updated, but starting the app will show the old icon.

If you re-create the app, the new icon is displayed.

The cache key appears to be the modification time on the .app bundle itself; if you touch the bundle as part of an update, the new icon is loaded.

This didn't affect the Xcode template because every run is a new build, which implicitly touches the .app bundle.

This PR force touches the .app bundle on the macOS backends to ensure that the icon cache is busted.

Includes a coupe of cosmetic whitespace updates for good measure.

PR Checklist:

mhsmith commented 2 months ago

FYI: I've seen something similar on Android, and I never discovered any workaround other than uninstalling and reinstalling the app. But I think it only affected the icon visible in the apps list in the launcher, not the running app itself. It's possible this has been fixed on newer Android versions.