2 full screen monitors on Mojave


#1

I have an Electron app that needs to run full screen on two monitors.
I was using the following code to initialise the windows (the dimensions are hard coded because I know the resolution of the screens the app will be running on)

mainWindow = new BrowserWindow({x: 0, y: 0, width:1920, height: 1080, fullscreen:true, acceptFirstMouse: true});
secondWindow = new BrowserWindow({x: displays[1].bounds.x, y: 0, width: 1920, height:1080, fullscreen: true});

This was working fine in previous versions of OSX as long as the computer is set up to use separate spaces for each display. However on Mojave it is not working. The main window now launches fine and goes full screen, but the second window opens as a non-full screen window with some of the desktop revealed below it at the bottom, and it has a title bar and the display has a menu bar at the top too.

How can I get both screen to launch fullscreen on Mojave as it did on previous versions?


#2

In case anyone else is wondering - the solution seems to be to use mainWindow.setFullScreen(true) rather than to set this property in the initialiser.