electron-window-state icon indicating copy to clipboard operation
electron-window-state copied to clipboard

Multiple monitors, window opens on wrong monitor

Open adamdry opened this issue 6 years ago • 4 comments

I did these steps:

  • I added the code as per usage example
  • I ran my app, moved the window to the left screen (I have 3 24" screens)
  • maximised it
  • closed the window (the app is now terminated)
  • re-ran the app and the window opened maximised but in the centre screen

I'm running Ubuntu 16.04, using node 7.9.0, Chrome 58.0.3029.110, and Electron 1.7.8

Edit: Further testing shows that my app's window will maximise on which ever screen the terminal window I'm launching it from is on

adamdry avatar Oct 11 '17 18:10 adamdry

@adamdry This issue should have been fixed in the latest version 5.0.3

Please check and close this issue if solved.

tobiasmuecksch avatar Nov 26 '18 08:11 tobiasmuecksch

I am using altus, which uses 5.0.3. The issue still seems to exist for me: https://github.com/ShadyThGod/altus/issues/20. I also reported an issue here as well with a workaround for users: https://github.com/electron/electron/issues/17933 Maybe this could help resolving the issue?

ThexXTURBOXx avatar May 05 '19 13:05 ThexXTURBOXx

It keeps happening to me too. This is the configuration I have:

import { app, BrowserWindow } from 'electron'
import windowStateKeeper from 'electron-window-state'

let mainWindow

function createWindow () {
  /**
   * Load the previous state with fallback to defaults
   */
  let mainWindowState = windowStateKeeper({
    defaultWidth: 1000,
    defaultHeight: 600
  })

  /**
   * Initial window options
   */
  const { width, height, x, y } = mainWindowState

  mainWindow = new BrowserWindow({
    width,
    height,
    x,
    y,
    webPreferences: {
      nodeIntegration: true
    }
  })

  mainWindow.setMenu(null)
  mainWindow.loadURL(process.env.APP_URL)

  mainWindowState.manage(mainWindow)

  mainWindow.on('closed', () => {
    mainWindow = null
  })
}

app.on('ready', createWindow)

danivalls avatar Dec 17 '19 09:12 danivalls

Experiencing this issue

kburns2kb avatar Mar 13 '23 20:03 kburns2kb