From fc5c8efc4e35209e749ea1faa9b6398f4b228a2a Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Sat, 24 Aug 2013 10:50:19 -0500 Subject: [PATCH] Add tm script to start tmux sessions --- bin/tm | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 bin/tm diff --git a/bin/tm b/bin/tm new file mode 100755 index 0000000..38349e2 --- /dev/null +++ b/bin/tm @@ -0,0 +1,31 @@ +#!/bin/sh +# export PATH=$PATH:/usr/local/bin + +# abort if we're already inside a TMUX session +[ "$TMUX" == "" ] || exit 0 +# startup a "default" session if non currently exists +# tmux has-session -t _default || tmux new-session -s _default -d + +# present menu for user to choose which workspace to open +PS3="Please choose your session: " +options=($(tmux list-sessions -F "#S") "New Session" "zsh") +echo "Available sessions" +echo "------------------" +echo " " +select opt in "${options[@]}" +do + case $opt in + "New Session") + read -p "Enter new session name: " SESSION_NAME + tmux new -s "$SESSION_NAME" + break + ;; + "zsh") + zsh --login + break;; + *) + tmux attach-session -t $opt + break + ;; + esac +done