Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ElectronJS Multiple Monitors

Tags:

electron

I'm attempting to create an application that opens 2 different BrowserWindows in Kiosk mode on 2 attached monitors. The only relevant documentation I see on how to do this is from this page which indicates that the second display should have a bounds > 0. Unfortunately, when I log the bounds of each Display, the x and y properties are 0 on both displays, although the size.width and size.height appear accurate.

Any thoughts on how to accomplish this multi-screen kiosk?

like image 946
Ryan Moore Avatar asked Aug 12 '18 12:08

Ryan Moore


People also ask

Can virtual machine use multiple monitors?

1 Answer. You can use the custom RDP property below to allow multiple monitors. This can be set on the host pool for Azure Virtual Desktop or placed in the RDP settings file for RDS. It is the same for personal and shared/pooled session hosts.

Does shadow support multiple monitors?

Shadow lets you add an additional screen to your streaming session, giving you the freedom to set up a dual-screen experience. You can connect an additional screen on your desktop and mobile devices. To see if your device's operating system is compatible, refer to the compatible operating systems and devices.

Does Synergy support multiple monitors?

As long as the monitors are symmetrical (2x2, 4x4) or linear (2x1, 3x1, 4x1), Synergy will recognize them as one large screen, and the mouse movement between them will be seamless.


1 Answers

According to the documentation you could do the following.

const electron = require('electron')
const {app, BrowserWindow} = require('electron')

let win

app.on('ready', () => {
  let displays = electron.screen.getAllDisplays()
  let externalDisplay = displays.find((display) => {
    return display.bounds.x !== 0 || display.bounds.y !== 0
  })

  if (externalDisplay) {
    win = new BrowserWindow({
      x: externalDisplay.bounds.x + 50,
      y: externalDisplay.bounds.y + 50
    })
    win.loadURL('https://github.com')
  }
})
like image 99
DEDaniel Avatar answered Nov 15 '22 06:11

DEDaniel