Recently i've tried ColorSnapper app, and I've noticed that it works keeping other applications active.
(Check the screen below, as you can see safari window is still active and ColorSnapper keeps being active too).
How can is possible reproduce this effect ?
I just try it and LSBackgroundOnly is the solution, but you must set the level of the window.
Example :
[mySpecialNSWindow setLevel:NSMainMenuWindowLevel];
This will display the special window above the windows of other applications.
I think the right approach is a mixture of (1) making the app LSBackgroundOnly, (2) using a custom transparent window as described here and set its level to NSFloatingWindowLevel, (3) using something like this in your app delegate to monitor mouse movements though your app is not active and, for example, to let your window follow the mouse position:
[NSEvent addGlobalMonitorForEventsMatchingMask:NSMouseMovedMask handler:^(NSEvent *event) {
[window setFrameOrigin:[NSEvent mouseLocation]];
}];
You can then have views as you like in the (transparent) window, move them around and modify its contents according to the mouse position.
I believe these types of apps use LSBackgroundOnly
or LSUIElement
as Launch Services keys in their plist files (reference).
Here's a bit more about it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With