dotconfs/tmux.sh

23 lines
658 B
Bash
Raw Normal View History

2018-04-30 01:17:00 +02:00
#!/bin/bash
SESSION=main
tmux="tmux -2 -u -f $HOME/tmux.conf"
# if the session is already running, just attach to it.
$tmux has-session -t $SESSION
if [ $? -eq 0 ]; then
echo "Session $SESSION already exists. Attaching."
sleep 1
$tmux -u attach -t $SESSION
exit 0;
fi
# create a new session, named $SESSION, and detach from it
$tmux new-session -d -s $SESSION
$tmux new-window -t $SESSION:1
$tmux split-window -h -t $SESSION:1 'sudo htop'
$tmux split-window -v -t $SESSION:1 'sudo journalctl -f'
$tmux new-window -t $SESSION:2
$tmux new-window -t $SESSION:3
$tmux select-window -t $SESSION:1
$tmux attach -t $SESSION