[PR #9242] feat(tui): add configurable Kitty keyboard protocol mode #13036

Open
opened 2026-02-16 18:17:55 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/9242

State: open
Merged: No


Summary

Add user-configurable Kitty keyboard protocol setting to resolve keybind issues on different terminals. Users can now choose between "auto", "enabled", or "disabled" modes based on their terminal's capabilities.

Problem

From issue #4997, users were experiencing inconsistent keybind behavior across different terminals:

  • ctrl+m and similar bindings not working on iTerm2/Kitty
  • Doubled key events on older terminals
  • No way for users to configure the Kitty keyboard protocol mode

Solution

1. Configuration Schema

Added kitty_keyboard field to TUI configuration in packages/opencode/src/config/config.ts:

  • Type: "auto" | "enabled" | "disabled"
  • Default: "auto" (maintains current behavior)

2. TUI Integration

Modified packages/opencode/src/cli/cmd/tui/app.tsx to:

  • Fetch config from server on TUI startup
  • Map configuration value to OpenTUI's useKittyKeyboard option
  • Include debug logging and graceful error handling

3. SDK Types

Regenerated SDK types to include new tui.kitty_keyboard field.

Configuration Example

Users can now configure Kitty keyboard mode in their opencode.json:

{
  "tui": {
    "kitty_keyboard": "enabled"
  },
  "keybinds": {
    "model_list": "ctrl+m"  // Now works reliably!
  }
}

Configuration Values

Value Behavior Use Case
"auto" Use {} (best effort) Default, works on most terminals
"enabled" Use true Modern terminals (Kitty, iTerm2, WezTerm)
"disabled" Use false Older terminals or when experiencing doubled keys

Testing

  • TypeScript compilation passes
  • Configuration schema validated
  • ⚠️ Runtime testing requires manual verification with different terminals

Resolves

#4997 (Keybinds)

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9242 **State:** open **Merged:** No --- ## Summary Add user-configurable Kitty keyboard protocol setting to resolve keybind issues on different terminals. Users can now choose between "auto", "enabled", or "disabled" modes based on their terminal's capabilities. ## Problem From issue #4997, users were experiencing inconsistent keybind behavior across different terminals: - `ctrl+m` and similar bindings not working on iTerm2/Kitty - Doubled key events on older terminals - No way for users to configure the Kitty keyboard protocol mode ## Solution ### 1. Configuration Schema Added `kitty_keyboard` field to TUI configuration in `packages/opencode/src/config/config.ts`: - Type: `"auto" | "enabled" | "disabled"` - Default: `"auto"` (maintains current behavior) ### 2. TUI Integration Modified `packages/opencode/src/cli/cmd/tui/app.tsx` to: - Fetch config from server on TUI startup - Map configuration value to OpenTUI's `useKittyKeyboard` option - Include debug logging and graceful error handling ### 3. SDK Types Regenerated SDK types to include new `tui.kitty_keyboard` field. ## Configuration Example Users can now configure Kitty keyboard mode in their `opencode.json`: ```json { "tui": { "kitty_keyboard": "enabled" }, "keybinds": { "model_list": "ctrl+m" // Now works reliably! } } ``` ## Configuration Values | Value | Behavior | Use Case | |-------|----------|----------| | `"auto"` | Use `{}` (best effort) | Default, works on most terminals | | `"enabled"` | Use `true` | Modern terminals (Kitty, iTerm2, WezTerm) | | `"disabled"` | Use `false` | Older terminals or when experiencing doubled keys | ## Testing - ✅ TypeScript compilation passes - ✅ Configuration schema validated - ⚠️ Runtime testing requires manual verification with different terminals ## Resolves #4997 (Keybinds) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
yindo added the pull-request label 2026-02-16 18:17:55 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13036