Node-Webkit - Starting Maximized

后端 未结 1 866
伪装坚强ぢ
伪装坚强ぢ 2021-02-19 05:22

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

相关标签:
1条回答
  • 2021-02-19 06:17

    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.

    0 讨论(0)
提交回复
热议问题