Skip to content

fix: restore keyboard mode after session detach#394

Merged
asheshgoplani merged 1 commit intoasheshgoplani:mainfrom
seanfreiburg:fix/restore-keyboard-mode-on-detach
Mar 26, 2026
Merged

fix: restore keyboard mode after session detach#394
asheshgoplani merged 1 commit intoasheshgoplani:mainfrom
seanfreiburg:fix/restore-keyboard-mode-on-detach

Conversation

@seanfreiburg
Copy link
Copy Markdown
Contributor

Summary

  • After detaching from a session (Ctrl+Q), shift-modified shortcuts (M, R, F, W, etc.) stopped working in the main TUI
  • Root cause: tools inside the tmux session (e.g. Claude Code) enable the Kitty keyboard protocol, and detaching didn't reset it — leaving the outer terminal in CSI u mode that Bubble Tea can't parse
  • Fix: re-send DisableKittyKeyboard after PTY cleanup so the terminal reverts to legacy key reporting before Bubble Tea resumes input

Changes

  • internal/terminal/keyboard.go — new shared package with DisableKittyKeyboard and RestoreKittyKeyboard (extracted to avoid import cycle between ui and tmux)
  • internal/tmux/pty.go — call terminal.DisableKittyKeyboard in cleanupAttach() after style reset
  • internal/ui/keyboard_compat.go — delegate to internal/terminal instead of inlining escape sequences

Test plan

  • Launch agent-deck, attach to a Claude Code session, detach with Ctrl+Q
  • Verify Shift+M (Move), Shift+R (Restart), Shift+W (Worktree finish) all work after detach
  • Verified on Ghostty (macOS) — the terminal that triggered Shift key stopped working in main UI #382
  • All existing keyboard_compat tests pass

Fixes #382

🤖 Generated with Claude Code

After detaching from a tmux session with Ctrl+Q, the Kitty keyboard
protocol could remain enabled if a tool inside the session (e.g. Claude
Code) activated it. This left Bubble Tea unable to parse shift-modified
keys (M, R, F, W, etc.), making shortcuts like Move-to-group silently
fail.

Fix: re-send DisableKittyKeyboard after PTY cleanup so the outer
terminal reverts to legacy key reporting before Bubble Tea resumes.

Also extracts DisableKittyKeyboard/RestoreKittyKeyboard into a shared
internal/terminal package to avoid an import cycle between ui and tmux.

Fixes asheshgoplani#382
@seanfreiburg seanfreiburg force-pushed the fix/restore-keyboard-mode-on-detach branch from 96d8d40 to 6a1dc9b Compare March 19, 2026 21:20
Steven17D pushed a commit to Steven17D/agent-deck that referenced this pull request Mar 25, 2026
@asheshgoplani asheshgoplani merged commit 6af426c into asheshgoplani:main Mar 26, 2026
asheshgoplani added a commit that referenced this pull request Mar 26, 2026
Reverts #422 (Ctrl+Q bind), #420 (ANSI reset), #418 (extended-keys CSI u),
#394 (keyboard mode after detach). These changes broke session creation and
restart on macOS due to terminal capability detection differences.

Also adds schema migration upgrade tests for statedb.

Committed by Ashesh Goplani
Steven17D pushed a commit to Steven17D/agent-deck that referenced this pull request Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shift key stopped working in main UI

2 participants