Updated to allow multiple commands per window

This commit is contained in:
2026-07-21 15:36:22 -04:00
parent 674bcc13ee
commit 7091597c13
+11 -10
View File
@@ -12,7 +12,7 @@
set -euo pipefail set -euo pipefail
readonly TMUX_CONF="${HOME}/.tmux.conf" readonly TMUX_CONF="${HOME}/.tmux.conf.aamon"
# Ensure we are not nesting tmux sessions # Ensure we are not nesting tmux sessions
if [[ -n "${TMUX:-}" ]]; then if [[ -n "${TMUX:-}" ]]; then
@@ -21,16 +21,17 @@ if [[ -n "${TMUX:-}" ]]; then
fi fi
# Define session layouts as data maps: "window_index:window_name:command" # Define session layouts as data maps: "window_index:window_name:command"
# Index 1 is reserved for the initial session window (renamed inline). # Field separator is ';' to safely allow command chains (&&, ;, etc.) inside field 3.
# Index 1 is reserved for the initial session window.
declare -A SESSIONS declare -A SESSIONS
SESSIONS[mine]=" SESSIONS[mine]="
1:local(phansible@aamon): 1;local(phansible@aamon);
2:phansible@overlook:exec ssh phansible@overlook.tailc38dc9.ts.net 2;phansible@overlook;exec ssh phansible@overlook.tailc38dc9.ts.net
3:weechat:exec ssh overlook-ts && docker start weechat && docker attach weechat 3;weechat;ssh -t overlook-ts 'docker start -ai weechat'
4:chawley@overlook:exec ssh overlook-ts 4;chawley@overlook;exec ssh overlook-ts
5:chawley@shawshank:exec ssh shawshank-ts 5;chawley@shawshank;exec ssh shawshank-ts
6:root@derry:exec ssh derry-ts 6;root@derry;exec ssh derry-ts
" "
list_active_sessions() { list_active_sessions() {
@@ -75,9 +76,9 @@ fi
echo "Building session: ${session}" echo "Building session: ${session}"
# Process layout line by line # Process layout line by line using semicolon delimiter
first_window=true first_window=true
while IFS=':' read -r idx name cmd; do while IFS=';' read -r idx name cmd; do
[[ -z "${idx}" ]] && continue [[ -z "${idx}" ]] && continue
if [[ "${first_window}" == true ]]; then if [[ "${first_window}" == true ]]; then