The use of PJOGL.setIcon() for macOS

Hello Processing community,

I’m facing a peculiar issue with an application I’ve developed using Processing. I’ve created a custom icon for my application, but after installing it on macOS using the .pkg, upon running it, Processing’s default icon appears instead. Is there any differentiation between Windows and Mac when using the setIcon() method of PJOGL? (On Windows works great)

I’ve attempted various solutions, including:

  • Clearing the macOS icon cache.
  • Verifying and modifying the icon path in my code.
  • Restarting Dock and Finder after making changes.
  • Checking my application’s settings to ensure the custom icon is properly set and not being overridden by another setting.

Despite my efforts, the icon reverts to the default one second after displaying the custom one when launching the application. This leads me to think that there might be some macOS process overriding my configuration.

My specific questions are:

  • Are there any specific macOS details I should consider when changing icons in applications created with Processing?
  • Is there any setting within Processing that might be causing the icon to reset?
  • Has anyone experienced a similar issue or has any suggestions on how to resolve it?

Any guidance, suggestion, or reference would be greatly appreciated. I’m willing to provide more details if needed.

Thank you in advance for your time and assistance.

Are you aware that on MacOS the application icon is set by the info.plist in the bundle?

Create the .icns application icon using the image of your choice and then replace the pre-supplied Processing .icns in the bundle Contents/Resources folder. Right click on the exported app and then click on Show Package Contents in the popup menu to see the bundle files (if you don’t already know that).

Hey Svan! Thanks for the quick reply! I tried to replace the icon manually on the Contents/Resources folder, but when I run the app , i see the custom icon for a moment and after a couple of seconds the original Processing icon appears. (didnt worked macOS before actually, sorry for my ignorance)

Another technique is to right click on the icon of your exported app and select ‘Get Info’. When the GetInfo panel is displayed drag and drop your .icns image onto the displayed icon in the upper left hand corner. It should change over to your .icns.

icns

It changes but only for a few seconds when i run the app, after that the icon return to the original one from processing… im really confused jaja, sorry!

Any way to post a screenshot of your app bundle’s Resources folder contents? I would like to see what files are in there. How did you create the xxxx.icns image?

1 Yes of course, this is the icon that is shown on Applications (i stole it just for testing from Sublime Text).
2 This is the icon on the Resources folder:
3 When i open the app the icon shown its the correct one:
4 But after a second, when the app window appears, the icon change to Processing one:

image
(cant embed more than 1 img, sorry)

What editor are you using; that doesn’t look like the Processing editor.

Hey svan, sorry abotu the delay, im using Sublime Text as text editor, but as i said i replaced the processing icon with the sublime text one just for testing the problem and returns to the original as soon as the app opens.

Sublime knows which icon to use and it’s not the Processing icon. Try using the Processing editor to export your app and then change the icon to whatever you want and it should work as expected.

Thanks for the quick reply, and yes, sorry , i forgot to clarify that, i use Sublime Text to code but i export the app with Processing editor, and the issue happens anyway.

Any way to post the entire project so that we can try exporting it? If you are unable to do that then alternatively create a minimal example which demonstrates the problem and post that.

What value does the info.plist of your exported app have? Does it look like this:

We also need to see a screen shot of the opened Resources folder of your exported app (not a Sublime app screen shot).