Focus mode: type into a session directly from the list view
When running several agents in parallel I constantly need to send a quick prompt to one of them, answer a permission dialog, or just hit enter. Right now that means attach, type, ctrl-q, back to the list, for every small interaction. The preview already shows everything I need, I just can't type into it.
I built a "focus mode" for this and have been running it as a fork for a while:
- a key in the list view toggles focus mode on the selected session
- while focused, all keystrokes are forwarded to the session's PTY (runes, enter, esc, arrows, ctrl keys, bracketed paste), so you can write prompts and drive permission dialogs without attaching
- the session list stays visible, so you keep the status overview of the other sessions, which is the whole point of not attaching
- ctrl+q leaves focus mode and returns to normal list navigation
- esc is deliberately not an exit key so it still reaches the agent (Claude Code uses it to interrupt)
- mouse tracking is released while focused so native terminal selection and copy work, and restored on exit
- visual indication: green border, a "Preview ● input" tab label and a menu hint
Implementation is roughly 200 lines on top of v1.0.19: a new app state that intercepts KeyMsgs and writes the translated byte sequences to the session PTY (the same plumbing SendPrompt already uses), plus bubbletea's mouse enable/disable commands on enter/exit. Existing keybindings stay untouched; in my fork I remapped enter out of personal taste, but an upstream version would keep enter/o (attach) as they are and put focus mode on a new key, e.g. f.
Is this something you'd take as a PR? Happy to clean it up and send it.
Source: smtg-ai/claude-squad