feat(tui): query Kitty keyboard protocol support before enabling

- Query terminal with CSI ? u before enabling Kitty protocol
- Only enable protocol if terminal responds (100ms timeout)
- Mode-aware key parsing: when Kitty active, interpret legacy
  sequences as custom terminal mappings (e.g. \x1b\r = shift+enter)
- Add Terminal Setup section to README with Ghostty/wezterm config

fixes #439
This commit is contained in:
Mario Zechner 2026-01-05 22:52:13 +01:00
parent 0b9e3ada0c
commit c5d54a8413
5 changed files with 186 additions and 18 deletions

View file

@ -18,6 +18,7 @@ Works on Linux, macOS, and Windows (requires bash; see [Windows Setup](#windows-
- [Getting Started](#getting-started)
- [Installation](#installation)
- [Windows Setup](#windows-setup)
- [Terminal Setup](#terminal-setup)
- [API Keys & OAuth](#api-keys--oauth)
- [Quick Start](#quick-start)
- [Usage](#usage)
@ -115,6 +116,28 @@ For most users, [Git for Windows](https://git-scm.com/download/win) is sufficien
}
```
### Terminal Setup
Pi uses the [Kitty keyboard protocol](https://sw.kovidgoyal.net/kitty/keyboard-protocol/) for reliable modifier key detection. Most modern terminals support this protocol, but some require configuration.
**Kitty, iTerm2:** Work out of the box.
**Ghostty:** Add to your Ghostty config (`~/.config/ghostty/config`):
```
keybind = alt+backspace=text:\x1b\x7f
keybind = shift+enter=text:\n
```
**wezterm:** Create `~/.wezterm.lua`:
```lua
local wezterm = require 'wezterm'
local config = wezterm.config_builder()
config.enable_kitty_keyboard = true
return config
```
### API Keys & OAuth
**Option 1: Auth file** (recommended)