Skip to content

feat(app): support Mod+J to toggle terminal - #55016

Closed
kitlangton wants to merge 1 commit into
betafrom
terminal-toggle-keybind
Closed

kitlangton wants to merge 1 commit into
betafrom
terminal-toggle-keybind

Conversation

@kitlangton

@kitlangton kitlangton commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

▶ Pitch (phone, 40 s):

pr-55016-phone.mp4

Desktop: https://github.com/user-attachments/assets/b88bec77-9985-4c27-af9e-251d98e9036d

Head: d4bdd453357aa302da140f027342a6bed966fd86

Confidence Size Affects API change Undo Reviewed by
High · one line, CI green +18/−1 · 2 files desktop No: default keybind only Rebind in Settings · or revert one line Opus 5.5 · review bot · bot: no blockers (earlier head)

Risk: On Windows and Linux the shortcut is Ctrl+J, which fzf uses, so a focused terminal no longer gets it. Rebind it in Settings, or revert one line.

Not verified: Recorded in the web build of the desktop app (headless Chromium, Mac user agent) against a hermetic server, not the packaged Electron app. Ctrl+J on Windows and Linux not exercised. The review bot covered the earlier head 2e52effd36.

Why

In OpenCode Desktop and the web GUI, toggling the terminal dock is bound only to ⌃` (ctrl+\``). Users coming from ChatGPT/Codex, VS Code, Cursor, or Zed expect ⌘J (Mod+J`) to toggle the bottom terminal panel open and closed as well.

What Changes

  • Adds mod+j alongside ctrl+` on the terminal.toggle command (bind: "ctrl+\,mod+j"), keeping `` ⌃ / Ctrl+`` as the primary displayed shortcut in menus, the command palette, and Settings > Shortcuts while allowing⌘J (Ctrl+J` on Windows/Linux) to toggle the terminal dock.
  • Because terminal.tsx delegates its custom key event check to keybinds.matches("terminal.toggle", event), both Mod+J and Ctrl+` are intercepted before reaching the PTY and toggle the terminal closed even when the terminal itself has focus.
Shortcut Terminal closed Terminal open & focused
Mod+J (⌘J / Ctrl+J) Opens terminal dock and focuses active terminal Closes terminal dock without sending input to PTY
Ctrl+` (⌃`) Opens terminal dock and focuses active terminal Closes terminal dock without sending input to PTY

Demo

Side-by-side Playwright capture of the web/desktop GUI before (b4a57f6849) and after this change, pressing ⌘J once to open and focus the terminal dock and a second time while the terminal is focused to close it:

terminal-toggle-demo.mp4

Scope

  • Owns adding mod+j to the built-in terminal.toggle command and covering both shortcuts in the terminal input regression suite.

Verification

bun run lint:changed
bun run check
PLAYWRIGHT_PORT=3187 PLAYWRIGHT_SERVER_PORT=4187 PLAYWRIGHT_WORKERS=1 bunx playwright test e2e/regression/terminal-input.spec.ts
  • bun run lint:changed: 0 problems in 2 changed files.
  • bun run check: 35/35 package typechecks passed, 0 errors.
  • playwright test e2e/regression/terminal-input.spec.ts: 9/9 passed, including toggling the terminal open and closed with both Mod+J and Control+Backquote while focused without leaking input to the PTY.

Added by the opencode bot (AI-generated).

Related: #54559

@opencode-agent opencode-agent Bot left a comment

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.

Looks good. I ran e2e/regression/terminal-input.spec.ts in headless Chromium: it passes 9/9 with this change. With only the renderer.tsx line reverted, the new test fails because ControlOrMeta+j doesn't open the dock. gui-extensions typecheck passes. Nothing else in the app or the desktop menu binds mod+j.

Public API: unchanged. Only the default keybind of the built-in terminal.toggle command changes.

One trade-off is noted inline: on Linux/Windows, Ctrl+J no longer reaches a focused terminal.

Related: #54559

section: "terminal",
featured: true,
bind: "ctrl+`",
bind: "ctrl+`,mod+j",

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.

On Linux/Windows mod+j means Ctrl+J. terminal.tsx intercepts terminal.toggle matches before the PTY sees them, so a focused terminal can no longer receive ^J (line feed). fzf, vim, emacs and readline users rely on that key. VS Code makes the same choice and the binding can be changed in Settings, so I don't think this blocks the change. It's still a behaviour change for terminal users on those platforms, and could be worth a line in the release notes.

@kitlangton
kitlangton force-pushed the terminal-toggle-keybind branch from 66630c9 to d4bdd45 Compare October 16, 2026 18:58
@kitlangton
kitlangton changed the base branch from dev to beta October 16, 2026 18:58
@kitlangton

Copy link
Copy Markdown
Contributor Author

Closing: Beta already binds ⌘J to toggle the bottom panel.

@kitlangton kitlangton closed this Oct 25, 2026
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.

1 participant