Mac OS X Lion: Detect if another application is running in full screen mode?

后端 未结 4 1994
暗喜
暗喜 2021-01-01 16:09

In a Cocoa app, is there a way to tell if another application currently is in full screen mode?

My application is configured to show up on all Spaces and listens for

4条回答
  •  感动是毒
    2021-01-01 16:34

    Hmm, have you ruled out using applescript/scriptingbridge? You can get the size of windows from applescript and compare them to the size of the screen. (or do you not know which screen a given app is on?)
    Certain apps which are accessible will have an 'AXFullScreen' attribute on their windows. For example this works for some apps:

      tell application "System Events"
        tell process "Pages"
            repeat with myWin in windows
                get value of attribute "AXFullScreen" of myWin
            end repeat
        end tell 
    end tell
    

    The real action seems to be down in carbon... MacWindows.h and CarbonEvents.h have references to "FullScreen" in them.

    You will need to research this though.

提交回复
热议问题