My application is an Agent (doesn't show up in dock) until one specific window is shown, before showing that window I set the following to let the dock display the icon:
NSApp.setActivationPolicy(.regular)
When the window gets closed I set the following to hide the icon from the dock:
NSApp.setActivationPolicy(.accessory)
It works on most of the machines, however on others the app icon stays in dock in 'Recent' section with no 'active' indicator. I can manually remove it via right click and selecting 'remove from dock' but it appears again the next time the window is open. Is it even a 'Recent' section? What's the API to either remove the app from there or prevent it from being added to dock when it's open? Thank you!