fix: pr-bug-scan findings from #1583 (#1618)

Fixed Windows titlebar bugs: WindowControls icon now seeded via new ipc isMaximized() getter on mount; CSS height dropped from 42px to 36px; spacer added to floating right-sidebar toggle and RightSidebar header so content isn't occluded.

Findings addressed:
- [medium] src/renderer/src/App.tsx:50-54 — WindowControls maximize icon wrong on startup if window starts maximized
- [medium] src/renderer/src/assets/main.css:434-460 — Window controls 42px tall but titlebar 36px — bottom 6px overlays content
- [low] src/renderer/src/App.tsx:776-803 — Spacer only rendered in workspace-active titlebar branch

Rebased onto current main to drop ~140 unrelated stale-main reverts; only the 6 Fixer-summary files are touched.

Co-authored-by: orca-bot <bot@stably.ai>
This commit is contained in:
buf0-bot[bot]
2026-05-09 03:59:12 -07:00
committed by GitHub
co-authored by orca-bot
parent 6e91777f96
commit 9db736c330
6 changed files with 53 additions and 9 deletions
+11
View File
@@ -655,10 +655,20 @@ export function createMainWindow(
const onPopupMenu = (): void => {
Menu.getApplicationMenu()?.popup({ window: mainWindow })
}
// Why: the renderer's WindowControls mounts after ready-to-show, which is
// also when savedMaximized is restored — so window:maximize-changed has
// already fired (or not fired, if maximize() was called pre-mount) before
// the listener attaches. Expose a synchronous getter so the button can
// initialize its icon to match the current state on mount.
const isMaximizedChannel = 'window:isMaximized'
const onIsMaximized = (): boolean => {
return !mainWindow.isDestroyed() && mainWindow.isMaximized()
}
ipcMain.on(minimizeChannel, onMinimize)
ipcMain.on(maximizeChannel, onMaximize)
ipcMain.on(requestCloseChannel, onRequestClose)
ipcMain.on(popupMenuChannel, onPopupMenu)
ipcMain.handle(isMaximizedChannel, onIsMaximized)
ipcMain.on(confirmCloseChannel, onConfirmClose)
mainWindow.on('closed', () => {
@@ -671,6 +681,7 @@ export function createMainWindow(
ipcMain.removeListener(maximizeChannel, onMaximize)
ipcMain.removeListener(requestCloseChannel, onRequestClose)
ipcMain.removeListener(popupMenuChannel, onPopupMenu)
ipcMain.removeHandler(isMaximizedChannel)
ipcMain.removeListener(confirmCloseChannel, onConfirmClose)
ipcMain.removeListener(markdownFocusChannel, onMarkdownEditorFocused)
mainWindow.webContents.removeListener('context-menu', onMainContextMenu)