help with executing command from one window to all others

10 views
Skip to first unread message

Boryeu Mao

unread,
Jul 10, 2026, 1:41:57 PM (11 days ago) Jul 10
to tmux-users
Dear All

I have a one-line bash script, file name ~/echotmux,

echo $(tmux display-message -p '#W')

which correctly displays the window name when run in individual windows (bash ~/echotmux).  With the following key binding,

:bind C-e command-prompt -p "Command:" "run \"tmux list-panes -s -F '##{session_name}:##{window_index}.##{pane_index}'|xargs -I PANE tmux send-keys -t PANE '%1' Enter\"",

in the command sequence

C-b C-e bash ~/echotmux

the tmux command in ~/echotmux is apparently first executed in the source window (with the window name SOURCE say) such that SOURCE is displayed in all windows.

How should ~/echotmux or the key binding, or both, be re-written such that the correct window name be displayed from the C-b C-e sequence?

Thanks all in advance
Boryeu Mao



Scott Rochford

unread,
Jul 11, 2026, 11:02:01 AM (10 days ago) Jul 11
to tmux-users
If you change ~/echotmux to this:

tmux display-message -p "$*"

And the bind to this, so the window_name is passed as a parameter:

:bind C-e command-prompt -p "Command:" "run \"tmux list-panes -s -F 'tmux send-keys -t ##{session_name}:##{window_index}.##{pane_index} %1 Space \\\"##{window_name}\\\" Enter' | bash\""

... maybe it does what you want?

--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/tmux-users/d1b9c3d8-8fae-4811-9bc1-134f96b95962n%40googlegroups.com.

Boryeu Mao

unread,
Jul 12, 2026, 2:50:58 PM (9 days ago) Jul 12
to Scott Rochford, tmux-users
Thanks very much, Scott, for the modified script and key-binding.  Yes it does now display the proper window name.  As a new tmux user (of whopping two weeks :), I will need to figure out the difference between the two different key bindings (and the associated scripts), and hopefully reconcile the two for a more general ~/echotmux (that may call any bash commands besides 'echo', or other executables. which I didn't make clear in posting the call for help) -- a home-work assignment :)

With Regards,
Boryeu
Reply all
Reply to author
Forward
0 new messages