Skip to content

feat(tasks): Cmd+Option+Left/Right to cycle task tabs#99

Open
wise-toddler wants to merge 9 commits into
debuglebowski:mainfrom
wise-toddler:fix/task-tab-shortcuts
Open

feat(tasks): Cmd+Option+Left/Right to cycle task tabs#99
wise-toddler wants to merge 9 commits into
debuglebowski:mainfrom
wise-toddler:fix/task-tab-shortcuts

Conversation

@wise-toddler

@wise-toddler wise-toddler commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add Cmd+Option+Left / Cmd+Option+Right to cycle through open task tabs in the top tab bar (wrap-around at edges, skips the home tab).
  • Suppress the new cycle shortcuts inside text inputs (INPUT, TEXTAREA, SELECT, contentEditable, role="textbox", CodeMirror, xterm, Milkdown, ProseMirror) so they don't hijack the macOS "move by word" cursor behavior.

Closes

Closes #98

Notes on the diff

This branch also includes two small unrelated fixes that the typecheck on main currently fails without:

  • fix(transport): add missing resolve-task route stub — registers a 501 stub for the missing module imported by rest-api/index.ts.
  • fix(app): add missing ws and @trpc/server deps for host-capability-server — adds runtime deps already used by packages/apps/app/src/main/host-capability-server.ts.

Happy to split these out into a separate PR if preferred.

Test plan

  • pnpm typecheck passes
  • pnpm --filter @slayzone/app test:e2e e2e/core/16-tab-management.spec.ts — 11/11 pass, including 4 new cases for the shortcuts above.
  • Manual: with multiple task tabs open, Cmd+Option+Left and Cmd+Option+Right cycle through them and wrap at the edges.
  • Manual: shortcuts do NOT fire while typing in an input, textarea, contentEditable field, CodeMirror editor, xterm terminal, Milkdown/ProseMirror editor, or native <select>.
  • Manual: with only the home tab open, the cycle shortcuts are a no-op.

Greptile Summary

This PR adds keyboard cycling for task tabs and a few support fixes. The main changes are:

  • New Cmd+Option+Left and Cmd+Option+Right task-tab shortcuts.
  • Guarding those shortcuts while typing in common editor and input surfaces.
  • E2E coverage for cycling, wrapping, home-tab jumps, and input suppression.
  • A missing resolve-task REST route stub.
  • Runtime dependencies for the app host capability server.

Confidence Score: 4/5

This is close, but the shortcut disabling path should be fixed before merging.

  • The new tab-cycling behavior matches the visible-tab model.
  • The new route stub follows the existing REST registration shape.
  • A user can disable the new shortcuts in settings and still have the default keys switch tabs.

packages/apps/app/src/renderer/src/app-shell/useAppShortcuts.ts

Important Files Changed

Filename Overview
packages/apps/app/src/renderer/src/app-shell/useAppShortcuts.ts Adds guarded next and previous task-tab hotkeys, but disabled custom bindings can still fall back to their defaults.
packages/shared/shortcuts/src/definitions.ts Adds customizable definitions for next and previous task-tab navigation.
packages/apps/app/e2e/core/16-tab-management.spec.ts Adds tests for task-tab shortcut cycling, wrap behavior, home-tab behavior, and input suppression.
packages/shared/transport/src/server/http/rest-api/sessions/resolve-task.ts Adds a 501 route stub that matches the surrounding REST route registration shape.
packages/apps/app/package.json Adds host capability server dependencies used by the app package.
pnpm-lock.yaml Updates locked dependency entries for the app package additions.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
packages/apps/app/src/renderer/src/app-shell/useAppShortcuts.ts:213
**Disabled shortcuts still fire**

`next-task-tab` and `prev-task-tab` are registered as customizable shortcuts, but this call reads them through the local `getKeys()` helper that treats a `null` override as missing and falls back to the default key. When a user disables Cmd+Option+Right or Cmd+Option+Left in shortcut settings, the handler is still bound to the default and can still switch task tabs while the user expected it to be unbound. Please make this path preserve explicit `null` overrides instead of falling back to the default.

Reviews (2): Last reviewed commit: "revert(shortcuts): drop Cmd+1..9 changes..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

Context used:

  • Context used - CLAUDE.md (source)
  • Context used - AGENTS.md (source)

Comment thread packages/apps/app/src/renderer/src/app-shell/useAppShortcuts.ts Outdated
Comment thread packages/shared/shortcuts/src/definitions.ts Outdated
…wski#98)

Original issue debuglebowski#98 asked for Cmd+1..9 as indexed jumps to the Nth task
tab. The Chrome-style "Cmd+9 = last tab" branch was an over-interpretation
of the spec. Restore Cmd+9 to indexed behavior: jump to the 9th task tab
if it exists, otherwise no-op.

- Delete the `last-task-tab` shortcut definition.
- Drop the dedicated `last-task-tab` handler; extend the indexed handler
  from `mod+1..8` to `mod+1..9`.
- Replace the "Cmd+9 = last" e2e test with an indexed-jump test
  (Cmd+3 with 3 tabs, Cmd+9 is a no-op).
@wise-toddler wise-toddler marked this pull request as draft June 26, 2026 19:13
…wski#98)

Original issue debuglebowski#98 listed numeric jumps as a 'bonus'. User confirmed only Cmd+Option+Left/Right is wanted. Restored main's switch-tab-1-9 behavior verbatim.
@wise-toddler wise-toddler changed the title feat(tasks): Cmd+Option+Left/Right and Cmd+1..9 to switch task tabs feat(tasks): Cmd+Option+Left/Right to cycle task tabs Jun 26, 2026
@wise-toddler wise-toddler marked this pull request as ready for review June 29, 2026 20:49
[visibleTabs.length, toFullIndex, toVisibleIndex, setActiveTabIndex]
)

useGuardedHotkeys(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Disabled shortcuts still fire

next-task-tab and prev-task-tab are registered as customizable shortcuts, but this call reads them through the local getKeys() helper that treats a null override as missing and falls back to the default key. When a user disables Cmd+Option+Right or Cmd+Option+Left in shortcut settings, the handler is still bound to the default and can still switch task tabs while the user expected it to be unbound. Please make this path preserve explicit null overrides instead of falling back to the default.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/apps/app/src/renderer/src/app-shell/useAppShortcuts.ts
Line: 213

Comment:
**Disabled shortcuts still fire**

`next-task-tab` and `prev-task-tab` are registered as customizable shortcuts, but this call reads them through the local `getKeys()` helper that treats a `null` override as missing and falls back to the default key. When a user disables Cmd+Option+Right or Cmd+Option+Left in shortcut settings, the handler is still bound to the default and can still switch task tabs while the user expected it to be unbound. Please make this path preserve explicit `null` overrides instead of falling back to the default.

How can I resolve this? If you propose a fix, please make it concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Cmd+Option+Left/Right to switch between open task tabs (top bar)

1 participant