I have an application in which I set the LSUIElement key to 1, so that it runs in background and does not show the icon in Dock.
My will is to make the application responsive to keystrokes or mouse events. Actually the main window appear only when the app is launched. With the main window visible, keystrokes are handled correctly, but if I close it there’s no way to show it again (and so keystrokes are ignored). I want my application to be responsive any time I push a particular key combination (as i.e. Scribblet does for those who know it).
Can anyone tell me where I can find information about how to do this?
I have an application in which I set the LSUIElement key to 1, so
Share
The status bar application is only active, and thus your application can only receive events, when the window or the menu is already open.
Your application can implement a “hot key” by setting up an Event Tap:
This will allow your application to inspect
keyDownevents before they are routed to other applications. See Callbacks for how your callback function needs to look and behave.There’s also a probably easier-to-use Cocoa class written by Dave DeLong available on GitHub: DDHotKey.