Search code examples
objective-cmacosnsapplication

How do I disable my application from participating in the ⌘+tab cycle on macOS?


I'm trying to write a small utility that attaches itself to the current main/key window. I've managed to make sure that the window cannot become key or main window, but it still shows up in the list of active applications when I use ⌘+tab.

The application should still be in the dock (so you can quit it and do other interactions), but I would rather that it didn't show up in the application list when pressing ⌘+tab.

I thought I had the answer when I discovered NSApplicationPresentationDisableProcessSwitching, but alas, that's system wide(!) which is certainly is not what I want.


Solution

  • Add "Application is an agent (UIElement)" to the Info.plist (raw key: NSUIElement) to remove yourself from the dock. Then create a status bar item (NSStatusItem) to hold your menu.