Last active
December 17, 2017 09:55
-
-
Save 89luca89/75714b981e8d142b36c7918f8569cd21 to your computer and use it in GitHub Desktop.
Manager for tmux sessions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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