Add tm script to start tmux sessions
This commit is contained in:
31
bin/tm
Executable file
31
bin/tm
Executable file
@@ -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
|
||||
Reference in New Issue
Block a user