I'm trying to go fullscreen with a second window on a second screen, tho I'm still seeing the menu bar.
This is my code:
let second_screen = NSScreen.screens()?[1]
let window = NSWindow(contentRect: (second_screen?.frame)!, styleMask: .fullScreen, backing: .buffered, defer: true, screen: second_screen)
self.window_controller = NSWindowController(window: window)
window.collectionBehavior = .fullScreenAuxiliary
window_controller?.showWindow(self)
window.toggleFullScreen(true)
Has anyone had any luck with this?
Edit 1:
I added this line:
NSApp.presentationOptions = [.fullScreen, .hideDock, .autoHideMenuBar]
and I got this warning:
setPresentationOptions called with NSApplicationPresentationFullScreen when there is no visible fullscreen window; this call will be ignored.
Edit 2:
I switched to this method:
let presOptions: NSApplicationPresentationOptions = [.hideDock, .hideMenuBar]
let optionsDictionary = [NSFullScreenModeApplicationPresentationOptions: NSNumber(value: presOptions.rawValue)]
self.fullscreen_view?.enterFullScreenMode((NSScreen.screens()?[1])!, withOptions: optionsDictionary)
The view goes fullscreen tho not showing the content, just grey.
Edit 3:
I turned NSFullScreenModeAllScreens off and now it kinda works:
let optionsDictionary = [NSFullScreenModeApplicationPresentationOptions: NSNumber(value: presOptions.rawValue), NSFullScreenModeAllScreens: false]
The only thing now is that the menu bar and dock don't show up on the first screen.