From dedbca326fe0337ae9c678a8579810a6c475a256 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 14 Jun 2026 18:02:41 -0500 Subject: feat(ai): disable C-z suspend in launched Claude panes An accidental C-z suspended Claude to the shell mid-session. C-z isn't a Claude Code keybinding. It's the tty's SIGTSTP char, delivered below the app, so the only place to clear it is the tty. The launcher now runs stty susp undef in each pane right before claude starts, so it's scoped to ai-launched panes. C-z keeps working as job control in every other terminal, shell, and program. --- claude-templates/bin/ai | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/claude-templates/bin/ai b/claude-templates/bin/ai index 63dc2e9..5a806ec 100755 --- a/claude-templates/bin/ai +++ b/claude-templates/bin/ai @@ -27,6 +27,13 @@ SESSION="ai" CLAUDE_CMD="claude" +# Run in the pane's shell just before Claude launches. `stty susp undef` clears +# the tty's SIGTSTP (C-z) character for this pane only, so an accidental C-z is +# passed through to Claude as input rather than suspending the session to the +# shell. Scoped here so C-z keeps working as job control in every other +# terminal, shell, and program. +LAUNCH_PREFIX="stty susp undef; " + # Format the per-project opening line passed to claude. Takes the project # directory's basename; returns a string of the form # "This is project. Follow all instructions in .ai/protocols.org." @@ -66,7 +73,7 @@ create_window() { wid=$(tmux new-window -a -t "$SESSION:{end}" -n "$name" -c "$dir" -P -F '#{window_id}') sleep 0.1 instructions=$(build_instructions "$name") - tmux send-keys -t "$wid" "$CLAUDE_CMD \"$instructions\"" Enter + tmux send-keys -t "$wid" "${LAUNCH_PREFIX}$CLAUDE_CMD \"$instructions\"" Enter echo "$wid" } @@ -311,7 +318,7 @@ single_mode() { local instructions wid=$(tmux new-session -d -s "$SESSION" -n "$name" -c "$dir" -P -F '#{window_id}') instructions=$(build_instructions "$name") - tmux send-keys -t "$wid" "$CLAUDE_CMD \"$instructions\"" Enter + tmux send-keys -t "$wid" "${LAUNCH_PREFIX}$CLAUDE_CMD \"$instructions\"" Enter fi sort_windows @@ -371,7 +378,7 @@ multi_mode() { local instructions first_wid=$(tmux new-session -d -s "$SESSION" -n "$name" -c "$dir" -P -F '#{window_id}') instructions=$(build_instructions "$name") - tmux send-keys -t "$first_wid" "$CLAUDE_CMD \"$instructions\"" Enter + tmux send-keys -t "$first_wid" "${LAUNCH_PREFIX}$CLAUDE_CMD \"$instructions\"" Enter for entry in "${selected[@]:1}"; do dir="${entry/#\~/$HOME}" name="$(basename "$dir")" -- cgit v1.2.3