Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App off the screen if user selects a different display as their main and then launches the electron app #38

Closed
mseltene opened this issue Aug 28, 2018 · 3 comments

Comments

@mseltene
Copy link

When a user changes their main display (2 monitors windows 10: right click on desktop -> display settings -> make this my main display), then electron-windows-state does not detect this and instead of resetting the coordinates, it shows on the old coordinates, which launches off the screen. The solution would be the user reverts their main display selection and then launch the app and move it to different monitor, and then reelects main display and then the app starts okay. If there is any I am missing in the code, please kindly advice, or is there a way to reset x, y coordinates or detect if the app is in the visible zone.

@mseltene
Copy link
Author

temporary fix,
let electron = require('electron')
let frame;
frame = new BrowserWindow({.....})
...
...
...
frame.once('ready-to-show', () => {
frame.show();
if(frame.getPosition()[0] > electron.screen.getAllDisplays()[0].bounds.width || frame.getPosition()[0] < 0){frame.setPosition(200,50,true)}
});

@pashvin
Copy link

pashvin commented Oct 13, 2018

It will be also nice if we can catch screen change event at run time and move app in primary screen when display attached is removed.
Ref: https://electronjs.org/docs/api/screen

We can fix this on our app but any chance to get this fix in this npm which will give advantage to all.

@tobiasmuecksch
Copy link

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

Please check and close this issue if solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants