Node-Webkit - Starting Maximized

Rewind picture Rewind · Aug 25, 2013 · Viewed 8.9k times · Source

I don't want a fullscreen application, but I would like to start a Node-Webkit application maximized. Can this be done? I am guessing its something to do with package.json, but can't seem to find what needs to be done.

Answer

Mar picture Mar · Aug 25, 2013

I don't think the manifest has an option to do that. Instead, call nw's Window.maximize() on startup. Something like:

// Load native UI library
var ngui = require('nw.gui');

// Get the current window
var nwin = ngui.Window.get();

Sometime later, in onload or some other point where you're ready to show the window:

onload = function() {
    nwin.show();
    nwin.maximize();
}

This is described in the node-webkit wiki. I don't think you can call maximize before showing the main window though (if it's hidden in manifest), but I haven't really dug into it.

You may want to consider saving the window position, from a UX standpoint. The wiki has an example for doing this.