Rohit
Rohit

Reputation: 450

ElectronJS is not able to detect dual monitor with different X11 DISPLAY value

I have an requirement where I am using dual monitors. Whenever we throw a login UI, one monitor will have login UI while another monitor has blank screen. I am able to achieve though Electron JS.

Above scenario is working fine when DISPLAY value for both monitors is :0. I am able to detect both monitors and able to launch two windows, one for login ui and another to cover monitors.

Working code:

numberOfScreens = screen.getAllDisplays()       // Return two monitor displays
numberOfScreens.forEach((display) => {
  console.log(display.bounds.x)                // Both monitor will have different X and Y values 
  console.log(display.bounds.y)
})

But same code is not working when there are two monitors with two different value for DISPLAY. Which are :0 and :0.1.

numberOfScreens = screen.getAllDisplays()  // Return one monitor display not able to detect another one.
numberOfScreens.forEach((display) => {
  console.log(display.bounds.x)          
  console.log(display.bounds.y)
})

It will be a great help if anyone can provide me solution to cover this use case as well. Thank you so much in advance.

Upvotes: 0

Views: 29

Answers (0)

Related Questions