Skip to content

Instantly share code, notes, and snippets.

@89luca89
Last active December 17, 2017 09:55
Show Gist options
  • Save 89luca89/75714b981e8d142b36c7918f8569cd21 to your computer and use it in GitHub Desktop.
Save 89luca89/75714b981e8d142b36c7918f8569cd21 to your computer and use it in GitHub Desktop.
Manager for tmux sessions
#!/bin/bash
# abort if we're already inside a TMUX session
if [ ! -z "$TMUX" ]; then
unset TMUX
fi
# 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=("New Default Session" "New IDE Session" $(tmux list-sessions -F "#S" 2>/dev/null) )
echo "Available sessions"
echo "------------------"
echo " "
select opt in "${options[@]}"
do
case $opt in
"New Default Session")
read -p "Enter new session name: " SESSION_NAME
printf "\033]0;$SESSION_NAME\a"
tmux new -s "$SESSION_NAME"
break
;;
"New IDE Session")
read -p "Enter new session name: " SESSION_NAME
printf "\033]0;$SESSION_NAME\a"
tmux new -s "$SESSION_NAME" 'tmux source-file /home/luca-linux/bin/tmux-ide'
break
;;
*)
printf "\033]0;$opt\a"
tmux attach-session -t $opt
break
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment