fix(desktop): dispose the HUD snap shortcut on native window close

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.
This commit is contained in:
pierrenode
2026-08-10 15:07:40 +03:00
committed by Teknium
parent 101dfd782d
commit 245efdaaa3
+8 -2
View File
@@ -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)
})