Updated tmux launcher with working version.

Initial version had some bit that didn't exit correctly. Finally debugged and now updated here.
This commit is contained in:
daryl
2022-06-27 09:15:27 +09:30
parent b1fdb7bfe8
commit 45f8982734

View File

@@ -1,17 +1,12 @@
#!/bin/bash
tmux new -s buildsw -d # create new session with a name and detach
tmux rename-window -t buildsw:0 "This is window foo." # rename (default) window 0 of foo to something cool
tmux split-window -t buildsw:0 -v -p 60 # split into top and bottom panes with 60/40 row split
tmux send-keys -t buildsw:0.0 'top' 'C-m' # run a thing in the top pane, can use 'C-m' or 'Enter'
tmux send-keys -t buildsw:0.1 'make all' 'C-m' # run another thing in the bottom pane
tmux new -s sessionname -d # create new session with a name and detach
tmux rename-window -t sessionname:0 "This is window foo." # rename (default) window 0 of foo to something cool
tmux split-window -t sessionname:0 -v -p 60 # split into top and bottom panes with 60/40 row split
tmux send-keys -t sessionname:0.0 'top' 'C-m' # run a thing in the top pane, can use 'C-m' or 'Enter'
tmux send-keys -t sessionname:0.1 'script.bs $@' 'C-m' # run another thing in the bottom pane, passing through cli arguments
sleep 2 # wait for PID to get created and be available for use (Why is this needed?)
MYPID=`pgrep exec2`
tmux attach -t buildsw # jump into the active session to watch things happen
tail --pid=$MYPID -f /dev/null # funky thing tail can do - wait for process to finish!
tmux attach -t sessionname # jump into the active session to watch things happen
tmux send-keys -t buildsw:0.0 'q' 'C-m' # tell 'top' in top pane to quit (C-m probably not needed here...)
tmux kill-session -t buildsw # close tmux session
# This mostly works, just doesn't seem to exit the session correctly.
tmux send-keys -t sessionname:0.0 'q' 'C-m' # tell 'top' in top pane to quit (C-m probably not needed here...)
tmux kill-session -t sessionname # close tmux session