aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorCody Hiar <codyfh@gmail.com>2019-03-06 19:14:56 +0000
committerCody Hiar <codyfh@gmail.com>2019-03-06 19:14:56 +0000
commit19831aa6a002a8c981564b52ffaa94218993385c (patch)
treee5933f71796af705cd7d427fe9ff8bd2233a90ba /scripts
parente3bb01fd2b859d9144beb585a1b3a8f478906b7d (diff)
Retain active pane on rolodex switch
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/rolodex.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/rolodex.sh b/scripts/rolodex.sh
index 56010a2..ddc6ba0 100755
--- a/scripts/rolodex.sh
+++ b/scripts/rolodex.sh
@@ -31,6 +31,10 @@ get_number_of_active_window_panes() {
echo $(tmux lsp | wc -l)
}
+get_active_pane(){
+ echo $(tmux lsp | grep '(active)' | cut -c 1)
+}
+
get_number_of_buffer_window_panes() {
echo $(tmux lsp -t 2 | wc -l)
}
@@ -52,6 +56,7 @@ main() {
ACTION="${ARGS[0]}"
fi
+ ACTIVE_PANE=$(get_active_pane)
if [[ "$ACTION" == 'prev' ]]; then
open_drawer_if_unopen
tmux swap-pane -s 1.2 -t 2."$BUFFER_COUNT"
@@ -60,7 +65,7 @@ main() {
NEXT=$((i + 1))
tmux swap-pane -s 2."$i" -t 2."$NEXT"
done
- tmux select-pane -t 1.1
+ tmux select-pane -t 1."$ACTIVE_PANE"
elif [[ "$ACTION" == 'next' ]]; then
open_drawer_if_unopen
tmux swap-pane -s 1.2 -t 2.1
@@ -69,7 +74,7 @@ main() {
NEXT=$((i + 1))
tmux swap-pane -s 2."$i" -t 2."$NEXT"
done
- tmux select-pane -t 1.1
+ tmux select-pane -t 1."$ACTIVE_PANE"
else
echo "Command not recognized: $ACTION"
fi