How to open the window in fullscreen mode when the app starts?


#1

I’m sure this is an easy one, but i’m not getting this to work!
Shouldn’t this code open the window in fullscreen?

app.on('ready', () => {  
    mainWindow = new BrowserWindow({
        width: 1200,
        height: 800,
        fullscreen: true
    });
    mainWindow.toggleDevTools();
    mainWindow.setFullScreen(true);
    mainWindow.loadUrl('file://' + __dirname + '/../browser/index.html');

    mainWindow.on('closed', () => {
        mainWindow = null;
    });
});

#2

I asked the same in Slack and @bengotow gave me the correct answer mainWindow.maximize() fairly obvious!


#3

even though mainWindow.maximize() worked on this case, what the purpose of the fullscreen:true while creating a new BrowserWindow?


#4

What if we want the application to take up all of the sceen (cover every aspect of the OS). Is this possible?

Edit: mainWindow.setFullScreen(true); does what I wanted.


#5

Yes, my problem with using mainWindow.setFullScreen(true) was on Linux that doesn’t have a fullscreen mode. On Osx the app goes to fullscreen mode. I don’t know what happens in windows.


#6

I am using Ubuntu 14.04 and mainWindow.setFullScreen(true) works fine for me, what versions of Linux are not supported?


#7

hI @limoragni on windows it goes fullscreen just like any normal chrome would be expected to do.

fyi: “maximize” and “fullscreen” are two completely different things on Windows.


#8

FWIW, @limoragni’s original code in his question was the exact answer I was looking for (at least on the windows platform)