Question time: Getting NSPanel “Non activating” style functionality on an NSWindow

Posted on by Elliot Jackson

I’d appreciate any guidance you can offer here. NSPanel has a “Non activating” option for HUD Panels. I’d like to get that same functionality working on an NSWindow, i.e. I want the window to accept clicks but not take focus away from whatever the active app is.

I have tried creating an NSWindow subclass and setting canBecomeMainWindow and canBecomeKeyWindow to NO but that doesn’t seem to be working—I think because those settings only apply to windows within the same app.

What I’m trying to do here is prevent this flickering:

Sketch Panels gif

I’m pretty sure this is doable as apps like Alfred seem to be doing it but having spent the last couple of hours Googling I just can’t get it to work.

If you have any suggestions to share, thanks in advance!

Stack Overflow cross-post.

Posted in nooblife, obj-c and question-time