79707276

Date: 2025-07-19 13:26:50
Score: 0.5
Natty:
Report link

The answer by @Chip Jarred did not work for me on macOS 15.5 Sequoia. None of the Dock windows have a "Fullscreen Backdrop" kCGWindowName.

What worked for me was the simple check for multiple Dock windows that have a negative (around MIN_INT64) value as kCGWindowLayer. If there are more than one of those Dock windows, the app is running in fullscreen:

func isFullScreen() -> Bool {
    guard let windows = CGWindowListCopyWindowInfo(.optionOnScreenOnly, kCGNullWindowID) else {
        return false
    }

    var dockCount = 0
    for window in windows as NSArray
    {
        guard let winInfo = window as? NSDictionary else { continue }
        if winInfo["kCGWindowOwnerName"] as? String == "Dock"
        {
            let windowLayer = winInfo["kCGWindowLayer"]
            if let layerValue = windowLayer as? Int64, layerValue < 0 {
                dockCount += 1
                if dockCount > 1 {
                    return true
                }
            }
        }
    }
    
    return false
}
Reasons:
  • Blacklisted phrase (1): did not work
  • Whitelisted phrase (-1): worked for me
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @Chip
  • Low reputation (1):
Posted by: oli0060