Skip to content

Commit 480cf4d

Browse files
committed
WIP
1 parent 083e0dc commit 480cf4d

File tree

4 files changed

+60
-1
lines changed

4 files changed

+60
-1
lines changed

config/tmux/tmux.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ bind-key s choose-tree -sZ -F '#{?session_attached,📍, }#{?session_bell_flag,
3838
# https://man.openbsd.org/OpenBSD-current/man1/tmux.1#FORMATS
3939
set-option -g history-limit 100000
4040
set-option -g pane-active-border-style 'fg=red'
41-
set-option -g pane-border-format '> #{pane_index} > #{pane_id} > #{pane_current_command} > #{history_size} Lines >'
41+
set-option -g pane-border-format '> #{pane_index}:#{pane_id} > #{pane_current_command}#{?@a2a_node, > 🤖#{@a2a_node},} >'
4242
set-option -g pane-border-status top
4343
set-option -g pane-border-style 'fg=green'
4444
set-option -g status-interval 1

config/zsh/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
!aws.zsh
66
!keybind.zsh
77
!prompt.zsh
8+
!tmux.zsh
89
!zinit.zsh

config/zsh/.zshrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ eval "$(direnv hook zsh)"
3232
source "${ZDOTDIR}/aws.zsh"
3333
source "${ZDOTDIR}/keybind.zsh"
3434
source "${ZDOTDIR}/prompt.zsh"
35+
source "${ZDOTDIR}/tmux.zsh"
3536
source "${ZDOTDIR}/zinit.zsh"
3637

3738
# Safe-chain

config/zsh/tmux.zsh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env zsh
2+
# shellcheck disable=all
3+
# tmux-related functions and configurations
4+
5+
# Set A2A_NODE environment variable and update tmux environment
6+
# Usage: set_a2a_node <node_name>
7+
# e.g., set_a2a_node orchestrator
8+
# e.g., set_a2a_node worker
9+
# e.g., set_a2a_node observer
10+
set_a2a_node() {
11+
if [ -z "$1" ]; then
12+
echo "Usage: set_a2a_node <node_name>"
13+
echo "Example: set_a2a_node orchestrator"
14+
return 1
15+
fi
16+
17+
export A2A_NODE="$1"
18+
19+
# Update tmux pane-local option if running inside tmux
20+
if [ -n "$TMUX" ]; then
21+
tmux set-option -p @a2a_node "$A2A_NODE"
22+
fi
23+
24+
echo "A2A_NODE set to: $A2A_NODE"
25+
}
26+
27+
# Clear A2A_NODE
28+
clear_a2a_node() {
29+
unset A2A_NODE
30+
31+
if [ -n "$TMUX" ]; then
32+
tmux set-option -p -u @a2a_node
33+
fi
34+
35+
echo "A2A_NODE cleared"
36+
}
37+
38+
# Sync A2A_NODE to tmux pane-local option on every prompt
39+
# This ensures pane border displays the current shell value
40+
_sync_a2a_node_to_tmux() {
41+
if [ -n "$TMUX" ]; then
42+
if [ -n "$A2A_NODE" ]; then
43+
# Only update if value changed
44+
local tmux_value=$(tmux show-option -pv @a2a_node 2>/dev/null)
45+
if [ "$tmux_value" != "$A2A_NODE" ]; then
46+
tmux set-option -p @a2a_node "$A2A_NODE" 2>/dev/null
47+
fi
48+
else
49+
# Unset if A2A_NODE is not set in shell
50+
tmux show-option -p @a2a_node &>/dev/null && tmux set-option -p -u @a2a_node 2>/dev/null
51+
fi
52+
fi
53+
}
54+
55+
# Add to precmd hooks
56+
autoload -Uz add-zsh-hook
57+
add-zsh-hook precmd _sync_a2a_node_to_tmux

0 commit comments

Comments
 (0)