diff --git a/README.md b/README.md index 7d821538..c7527928 100644 --- a/README.md +++ b/README.md @@ -483,7 +483,8 @@ Single-digit selection (1-9), color-coded status, token counts, auto-refresh. De |----------|--------| | `Ctrl/Cmd+W` | Kill active session | | `Ctrl/Cmd+Tab` | Next session | -| `Alt+1`–`Alt+9` | Switch to tab N | +| `Option+[` / `Option+]` | Previous / next session | +| `Option+1`-`Option+9` | Switch to tab N (physical keys, so macOS Option layouts work) | | `Ctrl+Shift+{` / `Ctrl+Shift+}` | Move active tab left / right | | `Ctrl/Cmd+L` | Clear terminal | | `Ctrl+Shift+R` | Restore terminal size | diff --git a/src/web/public/app.js b/src/web/public/app.js index e5843288..1dd10b6d 100644 --- a/src/web/public/app.js +++ b/src/web/public/app.js @@ -770,14 +770,31 @@ class CodemanApp { if (this.attachmentHistoryDrawerOpen) this.closeAttachmentHistory(); } - // Alt+1-9: switch to Codeman session by index - if (e.altKey && !e.ctrlKey && !e.shiftKey && e.key >= '1' && e.key <= '9') { - const idx = parseInt(e.key) - 1; - if (idx < this.sessionOrder.length) { + // Option/Alt session navigation uses physical key CODES, not e.key, so macOS + // keyboard layouts that emit special characters under Option (Option+1 -> ¡, + // Option+[ -> "“") still switch sessions. e.code is the physical key regardless + // of layout. Option+1-9 = switch by index; Option+[ / Option+] = prev / next. + if (e.altKey && !e.ctrlKey && !e.shiftKey) { + const code = e.code || ''; + const digitMatch = code.match(/^Digit([1-9])$/); + if (digitMatch) { + const idx = parseInt(digitMatch[1], 10) - 1; + if (idx < this.sessionOrder.length) { + e.preventDefault(); + this.selectSession(this.sessionOrder[idx]); + } + return; + } + if (e.code === 'BracketLeft') { e.preventDefault(); - this.selectSession(this.sessionOrder[idx]); + this.prevSession(); + return; + } + if (e.code === 'BracketRight') { + e.preventDefault(); + this.nextSession(); + return; } - return; } // Match against shortcut table diff --git a/src/web/public/index.html b/src/web/public/index.html index f0987d35..38194fb8 100644 --- a/src/web/public/index.html +++ b/src/web/public/index.html @@ -505,7 +505,8 @@