How to show full screen window programmatically in macOS

Issue #242

1
2
3
4
5
let window = NSWindow(contentRect: mainScreen.frame, styleMask: .borderless, backing: .buffered, defer: false)
window.level = .floating
window.contentView = NSView()
window.makeKeyAndOrderFront(NSApp)
NSApp.activate(ignoringOtherApps: true)

and then later hide it

1
window.orderOut(NSApp)

Comments