-
Notifications
You must be signed in to change notification settings - Fork 67
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 launched outside display area when second screen disconnected #44
Comments
Same here.. |
The algorithm that checks if the window can be displayed within display bounds is in the electron-window-state/index.js Lines 45 to 69 in 6bb0a3f
Here is an explanation of what this is doing:
This logic has drawbacks because it only takes into accounts positive values. Therefore it only works with this exact dual screen setup (with the window previously positioned in the second screen which is bigger than the primary one): |
Mac OSX is handling the window positioning differently than Windows. This difference can be simply tested by manually setting the main window position in a basic electron-quick-start example. With these options: mainWindow = new BrowserWindow({
'x': -100,
'y': 0,
'width': 800,
'height': 600,
}); the window in Windows will be 100px off the main screen and partly in the second screen, while on Mac OSX the window will be fully on the main screen. You can't position a window between two screens in OSX. Actually Microsoft VSCode seems to have an interesting implementation too. See vscode:src/vs/code/electron-main/window.ts |
PR #45 proposes to fix this issue. Check it out 🤙 |
With the merge of #45 this issue is hopefully fixed 👍 |
About
This bug has a reproduction step on Windows 10.
Mac OSX is also affected but seems to automatically correct wrong display positioning.
No clear info on Linux.
I know this issue was reported in multiple issues but this one tends to gather everything necessary to fix it.
Related: #1, #4, #27, #31, #38, #43.
Reproduction Steps
Here is a repo to reproduce the bug: MathieuDebit/electron-quick-start#3
The text was updated successfully, but these errors were encountered: