App Bundle Icon Overridden by Lazarus Assigned Icon lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- msintle · 2025-02-04 13:33 Does anybody know how Lazarus seems to "burn in" the icon that is specified in the Project Options window for a macOS LCL app? This icon seems to override the app bundle icon (.app/Contents/Resources/icon.icns), even with everything manifested properly (.app/Contents/info.plist). Very interesting behavior indeed! ---------------------------------------------------------------------- madref · 2025-02-04 15:52 the icon name must be the same as the app name ---------------------------------------------------------------------- msintle · 2025-02-04 17:42 Not even remotely applicable to my question! ---------------------------------------------------------------------- msintle · 2025-02-04 18:55 Another way to explain what I am trying to get at. File size of Lazarus binary on macOS compiled WITHOUT icon specified in Project Options: 19,399,272 bytes. File size of exactly the same source code WITH icon specified in Project Options: 19,473,008 bytes. So this icon is being stored INSIDE the macOS binary as a resource of some kind (like Windows) or in a separate fork (a la classic macOS?) And how does Lazarus communicate the presence of this icon to macOS? It OVERRIDES the icon that is specified as part of the application bundle! Is there actually a way to have the application bundle icon SUPERSEDE the icon Lazarus is embedding inside the binary? ---------------------------------------------------------------------- TRon · 2025-02-04 19:05 Quote from: msintle on February 04, 2025, 07:55:46 pmIs there actually a way to have the application bundle icon SUPERSEDE the icon Lazarus is embedding inside the binary? Change the icon in your project options. ---------------------------------------------------------------------- msintle · 2025-02-04 19:26 Quote from: TRon on February 04, 2025, 08:05:09 pmQuote from: msintle on February 04, 2025, 07:55:46 pmIs there actually a way to have the application bundle icon SUPERSEDE the icon Lazarus is embedding inside the binary? Change the icon in your project options. Very funny, but no, that is not the answer I am looking for. Where does Lazarus store the Project Options icon and how can I get rid of it programmatically after a build? ---------------------------------------------------------------------- TRon · 2025-02-04 19:29 Quote from: msintle on February 04, 2025, 08:26:01 pmWhere does Lazarus store the Project Options icon and how can I get rid of it programmatically after a build? It is a resource embedded in the executable. Remove the icon altogether from project options. You might perhaps think it is funny but who do you think displays that icon ? ---------------------------------------------------------------------- msintle · 2025-02-04 19:32 Quote from: TRon on February 04, 2025, 08:29:25 pmQuote from: msintle on February 04, 2025, 08:26:01 pmWhere does Lazarus store the Project Options icon and how can I get rid of it programmatically after a build? It is a resource embedded in the executable. Remove the icon altogether from project options. That would work, but then there's no way to specify these icons independently for each platform, is there? That is, keep the icon for Windows, but remove it for macOS? On macOS I can always specify my icon in the app bundle; on Windows, this isn't an option. Is there a command line compile setting that would make this possible? Or a way to strip the compiled resource on macOS after a build has been done? Or even an API call on macOS to "unbind" the resource icon so the app bundle icon takes precedence? ---------------------------------------------------------------------- TRon · 2025-02-04 19:35 You got a point there msintle. You could opt for including the resource manually (in code) depending on the platform. I am not aware there is an option present for that in the project options. edit: I mean that depending on the view of the Lazarus devs /and/ in case there is no other way around it  this might perhaps classify for filing a bug-report/feature-request. ---------------------------------------------------------------------- msintle · 2025-02-04 19:41 Quote from: TRon on February 04, 2025, 08:35:33 pmYou got a point there msintle. You could opt for including the resource manually (in code) depending on the platform. I am not aware there is an option present for that in the project options. I guess that's a workaround, at least. Where can I find more information on how Lazarus binds this resource and how it tells macOS to use this resource as the app icon? Would CocoaInt.CocoaIconUse := false help at all? Edit: The correct invocation seems to be CocoaConfigGlobal.useIcon and it does not help at all. ---------------------------------------------------------------------- TRon · 2025-02-04 20:04 Quote from: msintle on February 04, 2025, 08:41:05 pmWhere can I find more information on how Lazarus binds this resource and how it tells macOS to use this resource as the app icon? I am trying to get my head around this wiki article because if I understood your original issue correctly that seems to contradict your practical experience. fwiw the article contains some links that might perhaps be of interest to you. QuoteWould CocoaInt.CocoaIconUse := false help at all? tbh, I have no idea how resources work with MacOS (other than how resources work with fpc/lazarus). ---------------------------------------------------------------------- msintle · 2025-02-04 20:16 Quote from: TRon on February 04, 2025, 09:04:43 pmQuote from: msintle on February 04, 2025, 08:41:05 pmWhere can I find more information on how Lazarus binds this resource and how it tells macOS to use this resource as the app icon? I am trying to get my head around this wiki article because if I understood your original issue correctly that seems to contradict your practical experience. Exactly. The article is all about bundle icons. The crazy discovery for us here is that bundle icons are NOT being honored because of whatever voodoo Lazarus is doing to the compiled binary. Really incredible. Edit: Pretty sure there's some API the LCL is calling to activate the " resource icon". The app launches correctly with the bundle icon but then this icon is replaced with the "resource icon", never to return. Shall we be discovering tomorrow that Linux ELF binaries have also supported icons all along in this manner, and Lazarus is of course there to take advantage of it; ignoring whatever has been specified in .desktop files? Quote from: TRon on February 04, 2025, 09:04:43 pmfwiw the article contains some links that might perhaps be of interest to you. Which ones, just to make sure I'm not missing anything? Quote from: TRon on February 04, 2025, 09:04:43 pmQuoteWould CocoaInt.CocoaIconUse := false help at all? tbh, I have no idea how resources work with MacOS (other than how resources work with fpc/lazarus). Me neither, it wasn't until today that I found out this was even a possibility (a non-app-bundle icon that works on modern macOS [and in fact supersedes the bundle icon outright]). ---------------------------------------------------------------------- msintle · 2025-02-05 13:03 Quote from: TRon on February 04, 2025, 08:35:33 pmYou got a point there msintle. You could opt for including the resource manually (in code) depending on the platform. I am not aware there is an option present for that in the project options. edit: I mean that depending on the view of the Lazarus devs /and/ in case there is no other way around it  this might perhaps classify for filing a bug-report/feature-request. Unfortunately this workaround doesn't work either The cause? It's because the code we had painstakingly put together here to determine the size of a binary in Windows: https://forum.lazarus.freepascal.org/index.php/topic,64996.msg494833.h tml Reports the wrong size when I conditionally compile a resource file (something.res) that contains my icon. Really a bummer, that boxed up feeling, when your workaround seems to require (multiple) additional workarounds. :'( ---------------------------------------------------------------------- TRon · 2025-02-05 19:12 I have tried to gather information about how macos is suppose to act in these matter but quite frankly I hit a bit of a wall. Most likely because my lack of knowledge on/of the platform. Our wiki wasn't particularly helpful either (unless I overlooked/missed it). Took quite some time hence my delayed response. Would be nice if someone with more expertise/knowledge would be able to chime in also because I lack the hardware to be able to verify/check myself. ---------------------------------------------------------------------- msintle · 2025-02-05 20:35 Quote from: TRon on February 05, 2025, 08:12:24 pmI have tried to gather information about how macos is suppose to act in these matter but quite frankly I hit a bit of a wall. Most likely because my lack of knowledge on/of the platform. Our wiki wasn't particularly helpful either (unless I overlooked/missed it). Took quite some time hence my delayed response. Would be nice if someone with more expertise/knowledge would be able to chime in also because I lack the hardware to be able to verify/check myself. I appreciate the effort very much!