From d0345fd7f31a7b2be78456abc89c4c81394dff55 Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Sun, 2 Aug 2026 16:20:59 +0100 Subject: [PATCH] Enhance window management for macOS and Windows - Added functionality to maximize the window on macOS and set it to fullscreen on Windows during startup. - Introduced applyStartupWindowState function to manage initial window state based on the operating system. - Updated createMainWindow to call applyStartupWindowState for improved user experience. --- public/mainWindow.js | 6 ++++++ src/desktop/window.js | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/public/mainWindow.js b/public/mainWindow.js index 223c7f8..e9b7f41 100644 --- a/public/mainWindow.js +++ b/public/mainWindow.js @@ -227,6 +227,12 @@ export function createWindow() { setupWindowEvents() attachKeyboardShortcuts(win) setupNavigationGestures(win) + + if (process.platform === 'darwin') { + win.maximize() + } else if (process.platform === 'win32') { + win.setFullScreen(true) + } } export function getWindow() { diff --git a/src/desktop/window.js b/src/desktop/window.js index d4be591..8941bda 100644 --- a/src/desktop/window.js +++ b/src/desktop/window.js @@ -89,6 +89,18 @@ function broadcastWindowState() { sendToRenderer('windowState', getWindowState()) } +function applyStartupWindowState(window) { + if (!window) return + + if (isMacOS) { + window.maximize?.() + } else if (process.platform === 'win32') { + window.setFullScreen?.(true) + } + + setTimeout(broadcastWindowState, 100) +} + function setupWindowEvents(window) { // Electrobun emits resize/focus, not Electron's maximize/fullscreen events. window.on?.('resize', broadcastWindowState) @@ -166,6 +178,7 @@ export async function createMainWindow(rpc) { }) setupWindowEvents(mainWindow) + applyStartupWindowState(mainWindow) Electrobun.events.on('open-url', (event) => { const url = event?.data?.url