authorgravatar for maria@kuuro.netmaria <maria@kuuro.net> 2026-09-03 18:34:23-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-03 18:34:23-04:00
log678f23a69943e3eef7171f452b44f2931d2ef21f
tree59beccd4ab4e7726f38c98f18b3716d8f99e4825
parent77138cf33194a303adfbbd69cc93efa69f84245d
signature Signed by PGP key B5690EEEBB952194

fix(desktop): restore second-press quit fallback (#9485)

Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com>

2 files changed, 6 insertions(+), 8 deletions(-)

apps/desktop/src/window/QuitHold.test.ts+3-3
...@@ -368,14 +368,14 @@ describe("makeQuitShortcutHandler", () => {...@@ -368,14 +368,14 @@ describe("makeQuitShortcutHandler", () => {
368 expect(harness.notifications).toEqual([DOUBLE_CLICK_DOWN, UP, DOUBLE_CLICK_DOWN]);368 expect(harness.notifications).toEqual([DOUBLE_CLICK_DOWN, UP, DOUBLE_CLICK_DOWN]);
369 });369 });
370370
371 it("does not treat two quick presses as a quit in hold mode", async () => {371 it("quits on a quick second press in hold mode", async () => {
372 const harness = makeHarness();372 const harness = makeHarness();
373 await harness.send(makeInput({}));373 await harness.send(makeInput({}));
374 await harness.send(makeInput({ type: "keyUp" }));374 await harness.send(makeInput({ type: "keyUp" }));
375 vi.advanceTimersByTime(QUIT_DOUBLE_PRESS_MS - 100);375 vi.advanceTimersByTime(QUIT_DOUBLE_PRESS_MS - 100);
376 await harness.send(makeInput({}));376 await harness.send(makeInput({}));
377 expect(harness.quit).not.toHaveBeenCalled();377 expect(harness.quit).toHaveBeenCalledTimes(1);
378 expect(harness.notifications).toEqual([HOLD_DOWN, UP, HOLD_DOWN]);378 expect(harness.notifications).toEqual([HOLD_DOWN, UP]);
379 });379 });
380380
381 it("cancels the hold when another key interrupts it", async () => {381 it("cancels the hold when another key interrupts it", async () => {
apps/desktop/src/window/QuitHold.ts+3-5
...@@ -181,11 +181,9 @@ export function makeQuitShortcutHandler(...@@ -181,11 +181,9 @@ export function makeQuitShortcutHandler(
181 quitNow();181 quitNow();
182 return;182 return;
183 }183 }
184 if (184 // Keep a second press as an escape hatch when macOS misses the events
185 resolvedMode === "double-click" &&185 // that would complete a hold.
186 previousPressAt !== 0 &&186 if (previousPressAt !== 0 && now - previousPressAt <= QUIT_DOUBLE_PRESS_MS) {
187 now - previousPressAt <= QUIT_DOUBLE_PRESS_MS
188 ) {
189 quitNow();187 quitNow();
190 return;188 return;
191 }189 }