The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 12:00 UTC
fix(desktop): SnapShot shortcuts with arrow keys register on macOS and Windows (#22934)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
MarcoDotIO committed
Oct 30, 2026 at 16:44 UTC
ae1e89e6ba7eb9371b16bced010b92ef94dd8108
2 files changed
+23
-5
apps/desktop/src/snapShot/snapShot.test.ts
+17
@@ -1,5 +1,6 @@
1
import { it as effectIt } from "@effect/vitest";
2
import * as HostProcess from "@t3tools/shared/HostProcess";
3
+import { parseKeybindingShortcut } from "@t3tools/shared/keybindings";
4
import * as Effect from "effect/Effect";
5
import { describe, expect, it } from "vite-plus/test";
6
@@ -9,6 +10,7 @@ import {
10
compactAccessibilityTree,
11
findAccessibleWindow,
12
isWaylandSession,
13
+ toElectronAccelerator,
14
} from "./snapShot.ts";
15
16
describe("accessibleWindowText", () => {
@@ -448,6 +450,21 @@ describe("findAccessibleWindow", () => {
450
});
451
});
452
453
+describe("toElectronAccelerator", () => {
454
+ // The settings recorder stores shortcuts through parseKeybindingShortcut, which lowercases keys.
455
+ it.each([
456
+ ["mod+shift+arrowup", "CommandOrControl+Shift+Up"],
457
+ ["mod+shift+arrowdown", "CommandOrControl+Shift+Down"],
458
+ ["ctrl+alt+arrowleft", "Control+Alt+Left"],
459
+ ["ctrl+alt+arrowright", "Control+Alt+Right"],
460
+ ["mod+shift+esc", "CommandOrControl+Shift+Esc"],
461
+ ["mod+shift+space", "CommandOrControl+Shift+Space"],
462
+ ["mod+shift+2", "CommandOrControl+Shift+2"],
463
+ ])("maps a recorded %s to an Electron accelerator", (recorded, accelerator) => {
464
+ expect(toElectronAccelerator(parseKeybindingShortcut(recorded)!)).toBe(accelerator);
465
+ });
466
+});
467
+
468
describe("isWaylandSession", () => {
469
effectIt.effect(
470
"falls back to a live runtime directory socket when session variables are stripped",
apps/desktop/src/snapShot/snapShot.ts
+6
-5
@@ -539,14 +539,15 @@ function findBrowserTitleMatch<T extends { readonly name?: string | null }>(
539
return browserMatches.length === 1 ? browserMatches[0] : undefined;
540
}
541
542
+// Keyed by the lowercase tokens parseKeybindingShortcut stores; Electron has no `ArrowUp` token.
543
const ELECTRON_KEY_NAMES: Readonly<Record<string, string>> = {
544
" ": "Space",
545
"+": "Plus",
545
- ArrowDown: "Down",
546
- ArrowLeft: "Left",
547
- ArrowRight: "Right",
548
- ArrowUp: "Up",
549
- Escape: "Esc",
546
+ arrowdown: "Down",
547
+ arrowleft: "Left",
548
+ arrowright: "Right",
549
+ arrowup: "Up",
550
+ escape: "Esc",
551
};
552
553
export function sameSnapShotShortcut(left: SnapShotShortcut, right: SnapShotShortcut): boolean {