mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-15 04:11:47 +00:00
Revert "hotfix: fixed app launching offscreen"
This reverts commit ca92031e89.
This commit is contained in:
36
index.ts
36
index.ts
@ -225,16 +225,6 @@ function createMainWindow() {
|
|||||||
});
|
});
|
||||||
loadPlugins(win);
|
loadPlugins(win);
|
||||||
|
|
||||||
const scaleFactor = screen.getAllDisplays().length > 1 ? screen.getPrimaryDisplay().scaleFactor : 1;
|
|
||||||
|
|
||||||
if (windowSize) {
|
|
||||||
const scaledSize = {
|
|
||||||
width: windowSize.width / scaleFactor,
|
|
||||||
height: windowSize.height / scaleFactor,
|
|
||||||
};
|
|
||||||
win.setSize(scaledSize.width, scaledSize.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (windowPosition) {
|
if (windowPosition) {
|
||||||
const { x: windowX, y: windowY } = windowPosition;
|
const { x: windowX, y: windowY } = windowPosition;
|
||||||
const winSize = win.getSize();
|
const winSize = win.getSize();
|
||||||
@ -253,11 +243,7 @@ function createMainWindow() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const scaledPosition = {
|
win.setPosition(windowX, windowY);
|
||||||
x: windowX / scaleFactor,
|
|
||||||
y: windowY / scaleFactor,
|
|
||||||
};
|
|
||||||
win.setPosition(scaledPosition.x, scaledPosition.y);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,6 +261,26 @@ function createMainWindow() {
|
|||||||
win.webContents.loadURL(urlToLoad);
|
win.webContents.loadURL(urlToLoad);
|
||||||
win.on('closed', onClosed);
|
win.on('closed', onClosed);
|
||||||
|
|
||||||
|
const scaleFactor = screen.getAllDisplays().length > 1 ? screen.getPrimaryDisplay().scaleFactor : 1;
|
||||||
|
const size = config.get('window-size');
|
||||||
|
const position = config.get('window-position');
|
||||||
|
|
||||||
|
if (size && size.width && size.height) {
|
||||||
|
const scaledSize = {
|
||||||
|
width: size.width / scaleFactor,
|
||||||
|
height: size.height / scaleFactor,
|
||||||
|
};
|
||||||
|
win.setSize(scaledSize.width, scaledSize.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (position && position.x && position.y) {
|
||||||
|
const scaledPosition = {
|
||||||
|
x: position.x / scaleFactor,
|
||||||
|
y: position.y / scaleFactor,
|
||||||
|
};
|
||||||
|
win.setPosition(scaledPosition.x, scaledPosition.y);
|
||||||
|
}
|
||||||
|
|
||||||
type PiPOptions = typeof config.defaultConfig.plugins['picture-in-picture'];
|
type PiPOptions = typeof config.defaultConfig.plugins['picture-in-picture'];
|
||||||
const setPiPOptions = config.plugins.isEnabled('picture-in-picture')
|
const setPiPOptions = config.plugins.isEnabled('picture-in-picture')
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
|
|||||||
Reference in New Issue
Block a user