opencode
opencode copied to clipboard
feat(tui): add configurable Kitty keyboard protocol mode
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+mand 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
useKittyKeyboardoption - 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 [email protected]