Skip to content

Commit ae44fc1

Browse files
committed
fix(cmux): preserve automatic terminal tab titles
1 parent 17e2c78 commit ae44fc1

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

home/private_dot_config/zsh/cmux-agent-board.zsh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
# Track foreground command activity for each cmux terminal surface.
22
if [[ -n "${CMUX_WORKSPACE_ID:-}" && -n "${CMUX_SURFACE_ID:-}" ]]; then
33
autoload -Uz add-zsh-hook
4+
typeset -g _cmux_agent_board_prompt_seen=false
45

56
_cmux_agent_board_command_started() {
67
"$HOME/.local/bin/cmux-agent-board-state" working >/dev/null
78
}
89

910
_cmux_agent_board_command_finished() {
11+
# Let cmux assign its directory-based title before the first prompt.
12+
if [[ "$_cmux_agent_board_prompt_seen" == false ]]; then
13+
_cmux_agent_board_prompt_seen=true
14+
return
15+
fi
1016
"$HOME/.local/bin/cmux-agent-board-state" idle >/dev/null
1117
}
1218

scripts/test-cmux-agent-board-state.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ chmod +x "$shell_home/.local/bin/cmux-agent-board-state"
100100
HOME="$shell_home" MOCK_SHELL_CALLS="$shell_calls" \
101101
CMUX_WORKSPACE_ID='workspace-id' CMUX_SURFACE_ID='surface-id' \
102102
zsh -dfc '
103+
set -e
103104
source "$1"
105+
_cmux_agent_board_command_finished
106+
[[ ! -e "$MOCK_SHELL_CALLS" ]]
104107
_cmux_agent_board_command_started
105108
_cmux_agent_board_command_finished
106109
' _ "$SHELL_HOOKS"

0 commit comments

Comments
 (0)