Updated to allow multiple commands per window
This commit is contained in:
+11
-10
@@ -12,7 +12,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
readonly TMUX_CONF="${HOME}/.tmux.conf"
|
||||
readonly TMUX_CONF="${HOME}/.tmux.conf.aamon"
|
||||
|
||||
# Ensure we are not nesting tmux sessions
|
||||
if [[ -n "${TMUX:-}" ]]; then
|
||||
@@ -21,16 +21,17 @@ if [[ -n "${TMUX:-}" ]]; then
|
||||
fi
|
||||
|
||||
# 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
|
||||
|
||||
SESSIONS[mine]="
|
||||
1:local(phansible@aamon):
|
||||
2:phansible@overlook:exec ssh phansible@overlook.tailc38dc9.ts.net
|
||||
3:weechat:exec ssh overlook-ts && docker start weechat && docker attach weechat
|
||||
4:chawley@overlook:exec ssh overlook-ts
|
||||
5:chawley@shawshank:exec ssh shawshank-ts
|
||||
6:root@derry:exec ssh derry-ts
|
||||
1;local(phansible@aamon);
|
||||
2;phansible@overlook;exec ssh phansible@overlook.tailc38dc9.ts.net
|
||||
3;weechat;ssh -t overlook-ts 'docker start -ai weechat'
|
||||
4;chawley@overlook;exec ssh overlook-ts
|
||||
5;chawley@shawshank;exec ssh shawshank-ts
|
||||
6;root@derry;exec ssh derry-ts
|
||||
"
|
||||
|
||||
list_active_sessions() {
|
||||
@@ -75,9 +76,9 @@ fi
|
||||
|
||||
echo "Building session: ${session}"
|
||||
|
||||
# Process layout line by line
|
||||
# Process layout line by line using semicolon delimiter
|
||||
first_window=true
|
||||
while IFS=':' read -r idx name cmd; do
|
||||
while IFS=';' read -r idx name cmd; do
|
||||
[[ -z "${idx}" ]] && continue
|
||||
|
||||
if [[ "${first_window}" == true ]]; then
|
||||
|
||||
Reference in New Issue
Block a user