dotconf/bin/tstart
2020-08-18 07:44:57 -06:00

37 lines
628 B
Bash
Executable File

#!/bin/ksh
set -eu
SNAME="Main"
SSES="-s ${SNAME}"
IDX=1
if tmux ls | grep -q "^${SNAME}:"; then
tmux -u2 at -t "${SNAME}"
else
tmux -2 new-session -d $SSES
if [ -e ~/.tmux.windows ]; then
count=${IDX}
for n in $(cat ~/.tmux.windows); do
if [ $n == "_" ]; then
tmux new-window
else
if [ $count -eq ${IDX} ]; then
tmux rename-window "${n}"
else
tmux new-window -n "${n}"
fi
fi
((count=count+1))
done
else
tmux rename-window "IRC"
tmux new-window -n "Mail"
tmux new-window -n "Music"
tmux new-window
fi
tmux select-window -t${IDX}
tmux -2 attach-session -t $SNAME
fi