I have an application in java swing
which runs in the system tray most of the time. The user can use the Tray Menu
to perform several actions. One of those actions is to show the app window. The problem I have is with usability on OS X.
In windows, if the user brings up the app window and later switches to another app, they can switch back to my application using the taskbar. But in OS X, the app runs in a mode in which the app does not have a menu and also will not appear in the Command + Tab
list.
__LSUIElement
is set to true in the info.plist file
So my problem is that if the user opens the app window, later switches to another app, they cannot switch back unless they click on the window itself (which could be behind many other windows). The simplest way is for the user to open the window again using the tray icon, but since the window is already open I am unable to bring it to the front.
So, How to I take focus away from other applications and bring my window to the front?
EDIT:
My issue is not with getting the 'Application running as agent'. I already have that working. The issue I have is to get my program window to the top when its created. I am unable to do this in java.