I have an application with LSUIElement set to 1. It has a built-in editor, so I want the application to appear in the Cmd + Tab loop when the editor is open.
-(void)stepIntoForeground { if (NSAppKitVersionNumber < NSAppKitVersionNumber10_7) return; if (counter == 0) { ProcessSerialNumber psn = {0, kCurrentProcess}; OSStatus osstatus = TransformProcessType(&psn, kProcessTransformToForegroundApplication); if (osstatus == 0) { ++counter; } else { //... } } } -(void)stepIntoBackground { if (NSAppKitVersionNumber < NSAppKitVersionNumber10_7) return; if (counter == 0) return; if (counter == 1) { ProcessSerialNumber psn = {0, kCurrentProcess}; OSStatus osstatus = TransformProcessType(&psn, kProcessTransformToUIElementApplication); if (osstatus == 0) { --counter; } else { //.. } } }
Problems:
- there is also a dock icon (not a big deal);
- there is also a menu, it is also not very important, but they do not always appear.
Is there a way to disable the menu altogether or make it always displayed in the foreground? Thanks in advance.
source share