Change Window proprieties


Hello I am trying to change the proprieties of a window created as:

previewWindow = new BrowserWindow({
        title: "Panel Video Previewer",
        //fullscreen: true,
        height: 400,
        width: 400,
        resizable: false,
        alwaysOnTop: true,
        fullscreen: false,

        'node-integration': true,
        'web-preferences': {'web-security': false}

I open the window with the following code:

previewWindow.loadUrl('file://' + __dirname + '/app/preview.html');

previewWindow.on('closed', function()
    previewWindow = null;

previewWindow.webContents.on('did-finish-load', function()

Then I bind some Ipc events to change to full screen and change the size of the window:

var bindPreviewerWindowEvents = function()
    ipc.on('goFullScreenPreview', goFullScreenPreview);
    ipc.on('changePreviewWindowSize', changePreviewWindowSize);

var goFullScreenPreview = function(event, data)

var changePreviewWindowSize = function(event, size)
    console.log("changePreviewWindowSize w: " + size.width + " h: " + size.height);
    previewWindow.setSize(size.width, size.height);

The problem is the when I trigger the goFullScreenPreview ipc event it calls the goFullScreenPreview (prints the goFullScreenPreview) but the window does not go to fullscreen.

Another problem is when I trigger the changePreviewWindowSize it calls the changePreviewWindowSize function (prints changePreviewWindowSize) and the a crash popup with the message:

A JavaScript error occurred in the main process
Uncaught Exception:
TypeError: Error processing argument -1.
    at TypeError (native)
    at EventEmitter.changePreviewWindowSize (/home/edu/workspaces/testing/electron/filebrowser/main.js:143:19)
    at emitTwo (events.js:87:13)
    at EventEmitter.emit (events.js:172:7)
    at EventEmitter.<anonymous> (/home/edu/.electron/resources/atom.asar/browser/api/lib/web-contents.js:87:23)
    at emitTwo (events.js:87:13)
    at EventEmitter.emit (events.js:172:7)

I am using electron with the following versions:

  • ares: “1.10.1-DEV”
  • atom-shell: “0.34.1”
  • chrome: “45.0.2454.85”
  • electron: “0.34.1”
  • http_parser: “2.5.0”
  • modules: “46”
  • node: “4.1.1”
  • openssl: “1.0.2d”
  • uv: “1.7.4”
  • v8: “”
  • zlib: “1.2.8”

Running on ubuntu 14.04 32 bit

What am I doing wrong?
Is there any other way to change the window size proprieties.
Thank you for your help…


Your window is not going full size because you set resizable: false and your ipc events do not set resizeable: true before trying to change the size. I will look at your javascript error more, but typically -1 is an indicator or bad or wrong type input. Personally, I would check very carefully how the ‘size’ object is constructed first.