From 245efdaaa3fb49b25638f6b67b8eea041c8ba251 Mon Sep 17 00:00:00 2001 From: pierrenode <298902573+pierrenode@users.noreply.github.com> Date: Mon, 10 Aug 2026 15:07:40 +0300 Subject: [PATCH] fix(desktop): dispose the HUD snap shortcut on native window close MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 9c75e4863f added the global ⌘⇧G snap-to-cursor shortcut and wired its dispose() into closeHudWindow() and before-quit. It missed the HUD's own 'closed' listener (spawnHudWindow's win.on('closed', ...)), which fires when the window is closed from its own side — e.g. ⌘W — without going through closeHudWindow() first. After a ⌘W close, the shortcut stays registered with no HUD left to apply it to: harmless (applyHudSnapToPointer guards on a destroyed/null hudWindow) but it keeps CommandOrControl+Shift+G claimed until the HUD is reopened (register() releases first) or the app quits. dispose() is idempotent (guards on its own `active` chord), so calling it unconditionally in the 'closed' handler is safe even on paths where closeHudWindow() already released it. --- apps/desktop/electron/main.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts index 404bf05bb1..20ce3757e5 100644 --- a/apps/desktop/electron/main.ts +++ b/apps/desktop/electron/main.ts @@ -10559,8 +10559,14 @@ function spawnHudWindow(sessionId, profile) { hudWindow = null } - // Closed from its own side (⌘W) — put the app back so the user is never - // left with no surface, and correct every window's toggle. + // Closed from its own side (⌘W) — closeHudWindow()'s dispose() never ran, + // so the global snap shortcut would otherwise stay registered (and stuck + // taken) with no HUD left to apply it to. dispose() is idempotent, so + // this is safe even if closeHudWindow() already released it. + hudSnapShortcut.dispose() + + // Put the app back so the user is never left with no surface, and + // correct every window's toggle. restoreMainWindowFromHud() broadcastHudState(false) })