Preventing command-tab on Mac OS

Hello.
I’m looking for a way to block Command-Tab (application switching) on Mac (some apps, like Parallels Desktop do that; my application serves a similar purpose and would send Command-Tab to another path).
Perhaps I’ve not searched using the correct words (I tried many variations), but I couldn’t find something on the Internet.

I’m fearing a system extension is required (Parallels has plenty of them; I wouldn’t know how to make one).

Any idea?

When your app goes to background, you could bring it back to front.

https://developer.apple.com/documentation/appkit/nsapplicationpresentationoptions/nsapplicationpresentationdisableprocessswitching?language=objc

1 Like

Thank you very much!

Actually, I saw this NSApplicationPresentationDisableProcessSwitching in one of my searches, but the word “Presentation” led me to believe it was only for full screen or LSUIElement options and I didn’t even checked further :roll_eyes:

1 Like

Yes, that’s easy (Application.FrontmostMBS does that, among others), but I fail to see what it has to do with my question.
Thanks anyway.

Or just use the newer properties in NSApplicationMBS class:

  dim a as new NSApplicationMBS
  
  // hide dock
  a.presentationOptions = NSApplicationMBS. NSApplicationPresentationDisableProcessSwitching
1 Like

Oh, nice. I was going to attempt a declare, but it’s of course easier with the plugin.

It is funny as I came across that page the other day while I was looking for something else, so when I saw your question… bing!

Glad it was what you were looking for.

2 Likes

Agreed. And I have the (certainly wrong) feeling that this page and this property didn’t exist until recently, as if it was created just before you found it and I asked for it. :grin:

Thanks again, and to Christian too.

1 Like