mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
Merge branch 'master' into fix-restart-on-config-change
This commit is contained in:
20
index.js
20
index.js
@ -127,9 +127,27 @@ function createMainWindow() {
|
||||
autoHideMenuBar: config.get("options.hideMenu"),
|
||||
});
|
||||
remote.enable(win.webContents);
|
||||
|
||||
if (windowPosition) {
|
||||
const { x, y } = windowPosition;
|
||||
win.setPosition(x, y);
|
||||
const winSize = win.getSize();
|
||||
const displaySize =
|
||||
electron.screen.getDisplayNearestPoint(windowPosition).bounds;
|
||||
if (
|
||||
x + winSize[0] < displaySize.x - 8 ||
|
||||
x - winSize[0] > displaySize.x + displaySize.width ||
|
||||
y < displaySize.y - 8 ||
|
||||
y > displaySize.y + displaySize.height
|
||||
) {
|
||||
//Window is offscreen
|
||||
if (is.dev()) {
|
||||
console.log(
|
||||
`Window tried to render offscreen, windowSize=${winSize}, displaySize=${displaySize}, position=${windowPosition}`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
win.setPosition(x, y);
|
||||
}
|
||||
}
|
||||
if (windowMaximized) {
|
||||
win.maximize();
|
||||
|
||||
Reference in New Issue
Block a user