xin/bins/tstart.nix

42 lines
870 B
Nix
Raw Normal View History

2023-09-12 08:44:05 -06:00
{ tmux }:
let
2023-07-11 09:12:50 -06:00
tmuxBin = "${tmux}/bin/tmux";
2023-09-12 08:44:05 -06:00
in
''
2023-01-12 11:05:11 -07:00
#!/usr/bin/env sh
set -e
SNAME="Main"
SSES="-s $SNAME"
IDX=1
if ${tmuxBin} ls | grep -q "^''${SNAME}:"; then
${tmuxBin} -u2 at -t "$SNAME"
else
${tmuxBin} -2 new-session -d $SSES
if [ -e ~/.tmux.windows ]; then
count=$IDX
for n in $(cat ~/.tmux.windows); do
if [ $n == "_" ]; then
${tmuxBin} new-window
else
if [ $count -eq $IDX ]; then
${tmuxBin} rename-window "$n"
else
${tmuxBin} new-window -n "$n"
fi
fi
((count=count+1))
done
else
${tmuxBin} rename-window "IRC"
${tmuxBin} new-window -n "Mail"
${tmuxBin} new-window -n "Misc"
${tmuxBin} new-window
fi
${tmuxBin} select-window -t$IDX
${tmuxBin} -2 attach-session -t $SNAME
fi
''