diff options
author | Cody Hiar <chiar@hybridforge.com> | 2015-08-12 12:06:23 -0600 |
---|---|---|
committer | Cody Hiar <chiar@hybridforge.com> | 2015-08-12 12:06:23 -0600 |
commit | 07fc2644a237187dd4c5680e88f4adadbf533603 (patch) | |
tree | bb6335e180df48c5a6f0b893312857d36ad470f7 /scripts |
Initial commit of the working files
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/tmux_start.sh | 38 | ||||
-rwxr-xr-x | scripts/tmux_window_renum.sh | 15 |
2 files changed, 53 insertions, 0 deletions
diff --git a/scripts/tmux_start.sh b/scripts/tmux_start.sh new file mode 100755 index 0000000..bbf33c5 --- /dev/null +++ b/scripts/tmux_start.sh @@ -0,0 +1,38 @@ +#!/bin/sh +#from http://www.huyng.com/posts/productivity-boost-with-tmux-iterm2-workspaces/ +export PATH=$PATH:/usr/local/bin + +# abort if we're already inside a TMUX session +[ "$TMUX" == "" ] || exit 0 + +# startup a "default" session if none 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" "dashboard" $(tmux list-sessions -F "#S")) +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 + #;; + "dashboard") + tmuxomatic ~/.tmux/tmuxomatic/dashboard + break + ;; + "tmux") + tmux + break + ;; + *) + tmux attach-session -t $opt + break + ;; + esac +done diff --git a/scripts/tmux_window_renum.sh b/scripts/tmux_window_renum.sh new file mode 100755 index 0000000..6a63814 --- /dev/null +++ b/scripts/tmux_window_renum.sh @@ -0,0 +1,15 @@ +for session in $(tmux ls | awk -F: '{print $1}') ;do + active_window=$(tmux lsw -t ${session} | awk -F: '/\(active\)$/ {print $1}') + inum=0 + for window in $(tmux lsw -t ${session} | awk -F: '{print $1}') ;do + if [ ${window} -gt ${inum} ] ;then + echo "${session}:${window} -> ${session}:${inum}" + tmux movew -d -s ${session}:${window} -t ${session}:${inum} + fi + if [ ${window} = ${active_window} ] ;then + new_active_window=${inum} + fi + inum=$((${inum}+1)) + done + tmux select-window -t ${session}:${new_active_window} +done |