Skip to content

Commit 678f23a

Browse files
authored
fix(desktop): restore second-press quit fallback (pingdotgg#9485)
Co-authored-by: maria-rcks <[email protected]>
1 parent 77138cf commit 678f23a

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

‎apps/desktop/src/window/QuitHold.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,14 +368,14 @@ describe("makeQuitShortcutHandler", () => {
368368
expect(harness.notifications).toEqual([DOUBLE_CLICK_DOWN, UP, DOUBLE_CLICK_DOWN]);
369369
});
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 () => {
372372
const harness = makeHarness();
373373
await harness.send(makeInput({}));
374374
await harness.send(makeInput({ type: "keyUp" }));
375375
vi.advanceTimersByTime(QUIT_DOUBLE_PRESS_MS - 100);
376376
await harness.send(makeInput({}));
377-
expect(harness.quit).not.toHaveBeenCalled();
378-
expect(harness.notifications).toEqual([HOLD_DOWN, UP, HOLD_DOWN]);
377+
expect(harness.quit).toHaveBeenCalledTimes(1);
378+
expect(harness.notifications).toEqual([HOLD_DOWN, UP]);
379379
});
380380

381381
it("cancels the hold when another key interrupts it", async () => {

‎apps/desktop/src/window/QuitHold.ts‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,9 @@ export function makeQuitShortcutHandler(
181181
quitNow();
182182
return;
183183
}
184-
if (
185-
resolvedMode === "double-click" &&
186-
previousPressAt !== 0 &&
187-
now - previousPressAt <= QUIT_DOUBLE_PRESS_MS
188-
) {
184+
// Keep a second press as an escape hatch when macOS misses the events
185+
// that would complete a hold.
186+
if (previousPressAt !== 0 && now - previousPressAt <= QUIT_DOUBLE_PRESS_MS) {
189187
quitNow();
190188
return;
191189
}

0 commit comments

Comments
 (0)