mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
fix app starting offscreen
This commit is contained in:
9
index.js
9
index.js
@ -124,7 +124,14 @@ function createMainWindow() {
|
|||||||
remote.enable(win.webContents);
|
remote.enable(win.webContents);
|
||||||
if (windowPosition) {
|
if (windowPosition) {
|
||||||
const { x, y } = windowPosition;
|
const { x, y } = windowPosition;
|
||||||
win.setPosition(x, y);
|
if(x + win.getSize()[0] < 0 || x - win.getSize()[0] > electron.screen.getDisplayNearestPoint({x, y}).bounds.width) {
|
||||||
|
//Window is offscreen
|
||||||
|
if (is.dev()) {
|
||||||
|
console.log(`Window tried to render offscreen, Width=${win.getSize()[0]}, nearestDisplayPointer.bounds=${electron.screen.getDisplayNearestPoint({x, y}).bounds}, position=${{x, y}}`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
win.setPosition(x, y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (windowMaximized) {
|
if (windowMaximized) {
|
||||||
win.maximize();
|
win.maximize();
|
||||||
|
|||||||
Reference in New Issue
Block a user