diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-11 05:34:37 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-11 05:34:37 -0500 |
| commit | de555fa8b48c5ed5f17c0a8db9de7ecb946aa75d (patch) | |
| tree | 162fd451e5944fc7ef60eeddc388e6a1f51e0c5d /modules/ai-vterm.el | |
| parent | ca7015486d230192e94c51c0e5d014fc83a7a35f (diff) | |
| download | dotemacs-de555fa8b48c5ed5f17c0a8db9de7ecb946aa75d.tar.gz dotemacs-de555fa8b48c5ed5f17c0a8db9de7ecb946aa75d.zip | |
feat(ai-vterm): name the tmux session's first window "ai"
I pass `tmux new-session -n` so the window running the AI tool shows up as "ai" in the window list instead of auto-naming after the running program. A shell opened by hand in a later window still auto-names (e.g. "zsh"), so the two read distinctly. The name is a new `defcustom` (`cj/ai-vterm-tmux-window-name`), symmetric with the session-prefix custom.
Diffstat (limited to 'modules/ai-vterm.el')
| -rw-r--r-- | modules/ai-vterm.el | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/modules/ai-vterm.el b/modules/ai-vterm.el index 8f688301..7b84ba14 100644 --- a/modules/ai-vterm.el +++ b/modules/ai-vterm.el @@ -101,6 +101,17 @@ default \"aiv-\" is short for \"ai-vterm\"." :type 'string :group 'ai-vterm) +(defcustom cj/ai-vterm-tmux-window-name "ai" + "Name given to the first tmux window in an AI-vterm session. + +Passed as `tmux new-session -n', so the window running the AI tool +shows up as this name in `tmux ls' / the status line. A later +window opened by hand (e.g. a shell) auto-names after its command, +so the two read distinctly instead of both showing up as the +running program." + :type 'string + :group 'ai-vterm) + (defconst cj/--ai-vterm-name-prefix "claude [" "Buffer-name prefix shared by all AI-vterm buffers. @@ -191,20 +202,23 @@ looked up in SESSIONS, so the lossy whitespace->hyphen transform in (and (member (cj/--ai-vterm-tmux-session-name dir) sessions) t)) (defun cj/--ai-vterm-launch-command (dir) - "Return the shell command line that runs Claude in a project tmux session. + "Return the shell command line that runs the AI tool in a project tmux session. Uses `tmux new-session -A' so a second F9 on the same project reattaches to the running session instead of spawning a new one. The session name -is the project's basename via `cj/--ai-vterm-tmux-session-name'. +comes from `cj/--ai-vterm-tmux-session-name'; the first window is named +`cj/ai-vterm-tmux-window-name' (default \"ai\") so a later hand-opened +window auto-names after its command and the two read distinctly. The shell command run on first creation is - <claude-command>; exec bash -so the tmux window survives Claude exiting -- the session stays alive -with a bare bash prompt for recovery, and reattach works the same way." + <cj/ai-vterm-claude-command>; exec bash +so the tmux window survives the AI command exiting -- the session stays +alive with a bare bash prompt for recovery, and reattach works the same way." (let ((session (cj/--ai-vterm-tmux-session-name dir)) (start-dir (expand-file-name dir))) - (format "tmux new-session -A -s %s -c %s '%s'" + (format "tmux new-session -A -s %s -n %s -c %s '%s'" (shell-quote-argument session) + (shell-quote-argument cj/ai-vterm-tmux-window-name) (shell-quote-argument start-dir) (concat cj/ai-vterm-claude-command "; exec bash")))) |
