Ensure window stays on screen after external monitor removed.
This commit is contained in:
@@ -33,6 +33,7 @@ import {
|
||||
isKeepAliveTaskInstalled,
|
||||
setupKeepAliveTask,
|
||||
} from "./setup-keep-alive-task";
|
||||
import ensureWindowOnScreen from "./util/ensureWindowOnScreen";
|
||||
|
||||
Sentry.init({
|
||||
dsn: "https://ba41d22656999a8c1fd63bcb7df98650@o492140.ingest.us.sentry.io/4509074139447296",
|
||||
@@ -56,11 +57,14 @@ function createWindow(): void {
|
||||
y: number | undefined;
|
||||
};
|
||||
|
||||
// Validate window position is on screen
|
||||
const { validX, validY } = ensureWindowOnScreen(x, y, width, height);
|
||||
|
||||
const mainWindow = new BrowserWindow({
|
||||
width,
|
||||
height,
|
||||
x,
|
||||
y,
|
||||
x: validX,
|
||||
y: validY,
|
||||
show: false, // Start hidden, show later if not keep-alive
|
||||
minWidth: 600,
|
||||
minHeight: 400,
|
||||
|
||||
Reference in New Issue
Block a user