aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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