From 66ac241fcb895a9a529e0835defaab1f077803b8 Mon Sep 17 00:00:00 2001 From: Ammar Date: Sun, 19 Oct 2025 17:33:53 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Make=20window=20size=20responsiv?= =?UTF-8?q?e=20to=20screen=20dimensions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Calculate window size as 80% of primary display dimensions with minimum floor of 1200x800. Uses Electron's screen API to detect workArea (excludes taskbars/menubars). _Generated with `cmux`_ --- src/main.ts | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/main.ts b/src/main.ts index 475200979..4728b5a2f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,7 +3,15 @@ import "source-map-support/register"; import "disposablestack/auto"; import type { MenuItemConstructorOptions } from "electron"; -import { app, BrowserWindow, ipcMain as electronIpcMain, Menu, shell, dialog } from "electron"; +import { + app, + BrowserWindow, + ipcMain as electronIpcMain, + Menu, + shell, + dialog, + screen, +} from "electron"; import * as fs from "fs"; import * as path from "path"; import type { Config } from "./config"; @@ -314,9 +322,16 @@ function createWindow() { throw new Error("Services must be loaded before creating window"); } + // Calculate window size based on screen dimensions (80% of available space) + const primaryDisplay = screen.getPrimaryDisplay(); + const { width: screenWidth, height: screenHeight } = primaryDisplay.workArea; + + const windowWidth = Math.max(1200, Math.floor(screenWidth * 0.8)); + const windowHeight = Math.max(800, Math.floor(screenHeight * 0.8)); + mainWindow = new BrowserWindow({ - width: 1200, - height: 800, + width: windowWidth, + height: windowHeight, webPreferences: { nodeIntegration: false, contextIsolation: true,