Last active
January 16, 2024 16:18
-
-
Save flrichar/bfe95d130d980b9f279dd9d8ed388ed6 to your computer and use it in GitHub Desktop.
screen sessions in tmux groups
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if $(tmux has-session); then | |
echo "Tmux has-sessions, exiting..."; exit | |
else | |
echo "Tmux no sessions, creating..." | |
fi | |
SCREENWIN=$(printf 'C-a c %0.s' {1..5}) | |
TSESSION="tmux" | |
tmux new-session -s $TSESSION -d -n local | |
tmux split-window -h -t $TSESSION:0 | |
tmux split-window -v -t $TSESSION:0 | |
## screen-func | |
##tmux send-keys -t $TSESSION:0.0 'screen -S one' C-m $SCREENWIN | |
##tmux send-keys -t $TSESSION:0.1 'screen -S two' C-m $SCREENWIN | |
tmux new-window -t $TSESSION -n infra | |
tmux send-keys -t $TSESSION:1 'screen -S ONE' C-m $SCREENWIN | |
tmux split-window -v -t $TSESSION:1 | |
## horiz & vert split | |
#tmux split-window -h -t $TSESSION:1 | |
#tmux split-window -v -t $TSESSION:1.0 | |
## screen-func (extra screen sessions in tmux panels) | |
##tmux send-keys -t $TSESSION:1.0 'screen -S three' C-m $SCREENWIN | |
##tmux send-keys -t $TSESSION:1.1 'screen -S four' C-m $SCREENWIN | |
tmux select-window -t $TSESSION:0 | |
tmux select-pane -t 0 | |
echo "...done." | |
### | |
## modified to check for the session, eliminate some unnecessary screen sessions | |
## called from a taskfile as a function, also more verbose output for the user | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated this in January 2024...