From 07fc2644a237187dd4c5680e88f4adadbf533603 Mon Sep 17 00:00:00 2001 From: Cody Hiar Date: Wed, 12 Aug 2015 12:06:23 -0600 Subject: Initial commit of the working files --- scripts/tmux_window_renum.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 scripts/tmux_window_renum.sh (limited to 'scripts/tmux_window_renum.sh') 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 -- cgit v1.2.3