From 3043aa4d5b9d75e54e1558f621cc82983f639838 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Mar 2026 10:37:54 +0000 Subject: [PATCH] feat: add keyboard shortcuts 1-9, 0 to switch camera groups Keys 1-9 switch to camera groups 1-9 (sorted by order), key 0 switches to the 10th group. Shortcuts are ignored when viewing a single camera (selectedCameraName is set) and do not interfere with text input fields (handled by useKeyboardListener's built-in focus detection). https://claude.ai/code/session_018vH9fGSi5McLLa47GEiZJC --- web/src/pages/Live.tsx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/web/src/pages/Live.tsx b/web/src/pages/Live.tsx index 1b4bfb33a..876a2e570 100644 --- a/web/src/pages/Live.tsx +++ b/web/src/pages/Live.tsx @@ -65,6 +65,29 @@ function Live() { return false; }); + useKeyboardListener( + ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"], + (key, modifiers) => { + if (!modifiers.down || !config || selectedCameraName) { + return false; + } + + const groups = Object.entries(config.camera_groups).sort( + (a, b) => a[1].order - b[1].order, + ); + + // 1-9 → индексы 0-8, 0 → индекс 9 + const index = key === "0" ? 9 : parseInt(key) - 1; + + if (index < groups.length) { + setCameraGroup(groups[index][0]); + return true; + } + + return false; + }, + ); + // document title useEffect(() => {