Skip to content

fix(tui): make hotkeys & numpad work again in IDEs while focus is in TUI - #27665

Closed
Noitidart wants to merge 2 commits into
anomalyco:devfrom
Noitidart:27006-fix-ide-hotkeys
Closed

Noitidart wants to merge 2 commits into
anomalyco:devfrom
Noitidart:27006-fix-ide-hotkeys

Conversation

@Noitidart

@Noitidart Noitidart commented May 15, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #27006
Closes #16100

Type of change

  • Bug fix

What does this PR do?

When opencode runs in VS Code's integrated terminal (and forks like Cursor/Windsurf), IDE keyboard shortcuts stop forwarding to the IDE while the TUI has focus. This affects shortcuts like Cmd+Shift+E (file explorer), Ctrl+Shift+G (git sidebar), Cmd+Option+K (file reference prefill), and others.

The root issue is that VS Code's terminal does not support the Kitty keyboard protocol — microsoft/vscode#286809 was closed without implementing it. Enabling Kitty has no benefit in VS Code, but it triggers a keybinding dispatch bug (microsoft/vscode#304806) where the shortcut resolves correctly via "soft dispatching" but the event "cannot be dispatched" — the raw keystroke leaks to the terminal where the modifier key gets stripped.

It also triggers a Chromium regression (microsoft/vscode#299374) where numpad keys are reported as "Unidentified" when Kitty protocol is active, causing them to be silently dropped (#16100).

The fix detects VS Code's integrated terminal via TERM_PROGRAM=vscode (which Cursor and Windsurf also set since they're VS Code forks) and disables the Kitty keyboard protocol for that session by passing false to useKittyKeyboard. No functionality is lost since VS Code's terminal never supported Kitty to begin with. All other terminals retain full Kitty support.

How did you verify your code works?

Ran bun dev from a Cursor integrated terminal:

  • Cmd+Shift+E opens file explorer sidebar ✓
  • Ctrl+Shift+G opens git sidebar ✓
  • Cmd+Option+K inserts file reference ✓
  • All opencode TUI keybindings still work (Tab, /, arrows, etc.) ✓

Typecheck passes: all 14 packages pass bun turbo typecheck.

Screenshots / recordings

N/A — no UI changes, only keyboard input handling.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label May 15, 2026
@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label May 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@Noitidart
Noitidart force-pushed the 27006-fix-ide-hotkeys branch 4 times, most recently from 7138a65 to 61c4581 Compare May 15, 2026 05:21
@Noitidart Noitidart changed the title fix(tui): disable Kitty keyboard protocol in VS Code integrated terminal fix(tui): make IDE hotkeys work again while focus is in TUI May 15, 2026
@Noitidart
Noitidart force-pushed the 27006-fix-ide-hotkeys branch from 61c4581 to ab16cd5 Compare May 15, 2026 05:29
@Noitidart Noitidart changed the title fix(tui): make IDE hotkeys work again while focus is in TUI fix(tui): make hotkeys & numpad work again in IDEs while focus is in TUI May 15, 2026
@Noitidart
Noitidart force-pushed the 27006-fix-ide-hotkeys branch from ab16cd5 to 76752ca Compare May 15, 2026 15:31
@Noitidart
Noitidart force-pushed the 27006-fix-ide-hotkeys branch from 76752ca to bf5726d Compare May 22, 2026 18:08
@Noitidart

Copy link
Copy Markdown
Author

Just rebased this to make it current.

@Noitidart
Noitidart force-pushed the 27006-fix-ide-hotkeys branch from bf5726d to 0d8995d Compare May 27, 2026 04:45
Noitidart added 2 commits May 29, 2026 21:25
The /switch command, session list selection, fork, quick-switch, and subagent navigation all happened silently with no bus event, making it impossible for plugins and external tools to track which session the user is actively viewing. Now every call to session.get (which the TUI makes on every navigation) publishes a session.activated event with the sessionID, giving plugins a reliable signal to update their state.
… TUI

VS Code's terminal does not support the Kitty keyboard protocol
(microsoft/vscode#286809 was closed), so enabling it has no benefit
and triggers a shortcut dispatch bug where IDE keybindings like
Cmd+Shift+E and Ctrl+Shift+G stop forwarding while the TUI has focus
(microsoft/vscode#304806).

It also triggers a Chromium regression where numpad keys are reported
as "Unidentified" when Kitty protocol is active, causing them to be
silently dropped (microsoft/vscode#299374).

Detect VS Code's terminal via TERM_PROGRAM=vscode (also set by Cursor
and Windsurf) and pass false to useKittyKeyboard to prevent the
protocol from being activated. No functionality is lost since VS Code's
terminal never supported Kitty to begin with.

Fixes anomalyco#27006
Fixes anomalyco#16100
@Noitidart
Noitidart force-pushed the 27006-fix-ide-hotkeys branch from 0d8995d to 3a392bb Compare May 30, 2026 04:26
@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keyboard shortcuts not forwarding to IDE from opencode terminal Numpad keys not working when running inside VS Code 1.110 integrated terminal

1 participant