diff --git a/cos_117_tmux.cfg b/cos_117_tmux.cfg index f5f6857..f4a7dba 100644 --- a/cos_117_tmux.cfg +++ b/cos_117_tmux.cfg @@ -169,7 +169,7 @@ IopClusters { Console { TIChannelIdx 040 TOChannelIdx 041 - NewTerminalCommand "tmux new-window -d -t cray -n cray_{port} '{cmd}'&" + NewTerminalCommand "tmux new-session -d -s cray_{port} -n cray_{port} '{cmd}'&" ConsoleCommandLinux "telnet {host} {port}" ConsoleCommandWindows "putty.exe -load Unicos -telnet -P {port} {host}" MapBackspace yes @@ -179,7 +179,7 @@ IopClusters { Console { TIChannelIdx 042 TOChannelIdx 043 - NewTerminalCommand "tmux new-window -d -t cray -n cray_{port} '{cmd}'&" + NewTerminalCommand "tmux new-session -d -s cray_{port} -n cray_{port} '{cmd}'&" ConsoleCommandLinux "telnet {host} {port}" ConsoleCommandWindows "putty.exe -load Unicos -telnet -P {port} {host}" MapBackspace yes @@ -189,7 +189,7 @@ IopClusters { Console { TIChannelIdx 044 TOChannelIdx 045 - NewTerminalCommand "tmux new-window -d -t cray -n cray_{port} '{cmd}'&" + NewTerminalCommand "tmux new-session -d -s cray_{port} -n cray_{port} '{cmd}'&" ConsoleCommandLinux "telnet {host} {port}" ConsoleCommandWindows "putty.exe -load Unicos -telnet -P {port} {host}" MapBackspace yes @@ -199,7 +199,7 @@ IopClusters { Console { TIChannelIdx 046 TOChannelIdx 047 - NewTerminalCommand "tmux new-window -d -t cray -n cray_{port} '{cmd}'&" + NewTerminalCommand "tmux new-session -d -s cray_{port} -n cray_{port} '{cmd}'&" ConsoleCommandLinux "telnet {host} {port}" ConsoleCommandWindows "putty.exe -load Unicos -telnet -P {port} {host}" MapBackspace yes @@ -275,7 +275,7 @@ IopClusters { Console { TIChannelIdx 042 TOChannelIdx 043 - NewTerminalCommand "tmux new-window -d -t cray -n cray_{port} '{cmd}'&" + NewTerminalCommand "tmux new-session -d -s cray_{port} -n cray_{port} '{cmd}'&" ConsoleCommandLinux "telnet {host} {port}" ConsoleCommandWindows "putty.exe -load Unicos -telnet -P {port} {host}" MapBackspace yes @@ -297,7 +297,7 @@ IopClusters { Console { TIChannelIdx 042 TOChannelIdx 043 - NewTerminalCommand "tmux new-window -d -t cray -n cray_{port} '{cmd}'&" + NewTerminalCommand "tmux new-session -d -s cray_{port} -n cray_{port} '{cmd}'&" ConsoleCommandLinux "telnet {host} {port}" ConsoleCommandWindows "putty.exe -load Unicos -telnet -P {port} {host}" MapBackspace yes @@ -441,7 +441,7 @@ IopClusters { Console { TIChannelIdx 042 TOChannelIdx 043 - NewTerminalCommand "tmux new-window -d -t cray -n cray_{port} '{cmd}'&" + NewTerminalCommand "tmux new-session -d -s cray_{port} -n cray_{port} '{cmd}'&" ConsoleCommandLinux "telnet {host} {port}" ConsoleCommandWindows "putty.exe -load Unicos -telnet -P {port} {host}" MapBackspace yes diff --git a/tmux_run b/run_tmux old mode 100644 new mode 100755 similarity index 86% rename from tmux_run rename to run_tmux index 7a87207..fa53a4d --- a/tmux_run +++ b/run_tmux @@ -1,7 +1,6 @@ #!/bin/sh PATH=$PATH:simulator/_bin/linux_release -# Usage message usage() { cat << EOF @@ -53,8 +52,10 @@ cray_is_up() { start_cray() { if cray_is_up; then msg "running"; else mkdir -p dump disk tape - tmux new-session -d -s cray - #space for future tmux hooks here + tmux new-session -d -s cray + # Simplify the hooks, they could be error prone + tmux set-hook -t cray -g session-created 'run-shell "tmux list-sessions -F '#{session_name}' | grep '^cray_' | sort | while read -r session; do tmux move-window -s $session:0 -t cray:; done; tmux move-window -s cray:$(tmux list-windows -t cray | grep -n 'cray_sim' | cut -d: -f1) -t cray:0"' + tmux set-hook -t cray -g window-linked 'run-shell "tmux list-windows -t cray -F \"#{window_index}\" | awk '\''$1 != \"0\" {print \"tmux rename-window -t \" $1 \" console_\" NR-1}'\'' | bash"' tmux send-keys -t cray 'cray_sim cos_117_tmux.cfg' C-m msg "started" help @@ -96,7 +97,6 @@ restart_cray() { # Attach to the cray simulator session attach_cray() { if cray_is_up; then tmux attach-session -t cray; else msg "not_up"; fi } - # Display status of cray simulator session and consoles status_cray() { if cray_is_up; then