Search code examples
objective-cswiftmacosdesktop-applicationnsworkspace

How to hide fullscreen apps in MacOS programmatically


I'm trying to make an app that would hide other windows/apps with a certain interval, but I'm stuck with hiding fullscreen app windows using NSWorkspace and NSRunningApplication classes.

Is there any way to exit fullscreen mode programmatically using public APIs? If not, what private APIs I need to look at to achieve this task?


Solution

  • Assuming you can get around sandboxing, you can use AppleScript to tell System Events to tell the process in question to set its attribute "AXFullScreen" of window 1 to false.