1

This post provided answer to move a main window to second screen. If an app has two windows. How do I move second window to second screen or a specific screen? Any help will be greatly appreciated. Thanks.

Kevin H.
  • 73
  • 1
  • 8

1 Answers1

4

Found solution here https://github.com/RSATom/WebChimera/issues/105. Code for second window

var gui = require('nw.gui');
gui.Screen.Init();
win = gui.Window.get();
if (win.x < gui.Screen.screens[gui.Screen.screens.length -1].work_area.x) win.x = gui.Screen.screens[gui.Screen.screens.length -1].work_area.x + win.x;

var screenCB = {
    onDisplayAdded : function(screen) {
        win = gui.Window.get();
        if (win.x < screen.work_area.x) win.x = screen.work_area.x + win.x;
    }
};

gui.Screen.on('displayAdded', screenCB.onDisplayAdded);
Kevin H.
  • 73
  • 1
  • 8