tmux-utility.sh (1142B)
1 #!/bin/sh 2 SESSION=utility 3 echo "starting $SESSION tmux session" 4 5 if ! tmux has-session -t "$SESSION" 6 then 7 # Start services 8 mpd ~/.mpd/mpd.conf 9 eval "$(gpg-agent)" 10 GPG_TTY=$(tty) 11 export GPG_TTY 12 eval "$(ssh-agent)" 13 # Add ssh key if not already added 14 if [ "$(uname)" = "Darwin" ]; then 15 ssh-add -l | grep -q '\.ssh/id_rsa' || ssh-add -K 16 else 17 ssh-add -l | grep -q '\.ssh/id_rsa' || ssh-add 18 fi 19 20 # Create new session, name it, name the window, detach 21 tmux new-session -s "$SESSION" -n misc -d 22 23 tmux send-keys -t "$SESSION" "echo $PWD" C-m 24 tmux send-keys -t "$SESSION" "mutt" C-m 25 26 tmux select-pane -t "$SESSION":1.1 27 tmux split-window -p 33 -v -t "$SESSION" 28 tmux send-keys -t "$SESSION" "fortune" C-m 29 30 tmux new-window -t "$SESSION" -n "board" 31 tmux select-pane -t "$SESSION":2.1 32 tmux send-keys -t "$SESSION" "board $HOME" C-m 33 34 tmux new-window -t "$SESSION" -n "mpc" 35 tmux select-pane -t "$SESSION":3.1 36 tmux send-keys -t "$SESSION" "ncmpcpp" C-m 37 38 #tmux select-layout tiled 39 tmux select-pane -t "$SESSION":1.1 40 41 fi 42 tmux attach -t "$SESSION"