Sunday, 25 November 2018

Cursor not moving to secondary display in Electron

I'm trying to get the cursor to go to the secondary display, but it is staying in primary display.

I have referred to the following page, but I don't understand what I'm doing wrong: https://electronjs.org/docs/api/screen

Why doesn't the cursor go to the secondary display?

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');

    secondaryWindow = window.open("secondary.html" + (debug ? "?debug=1" : ""), 'Secondary Display', 'height=100%,width=100%,top=0,left=0,fullscreen=1,status=0,location=0,menubar=0,toolbar=0' );
  }
})



from Cursor not moving to secondary display in Electron

No comments:

Post a Comment