aboutsummaryrefslogtreecommitdiff
path: root/scripts/rolodex
diff options
context:
space:
mode:
authorCody Hiar <cody@hiar.ca>2021-02-02 10:03:15 -0700
committerCody Hiar <cody@hiar.ca>2021-02-02 10:03:15 -0700
commitccc94a31bf711a56a6c457c28089e4c53a7b28fd (patch)
tree5e7c32a8dfb68b9a2b3b931398c8ff03fdafea24 /scripts/rolodex
parente318abd0cd64a4adfd49813b49a688d53e2f57b9 (diff)
Switch the drawer pane to top. Bottom is straining
Diffstat (limited to 'scripts/rolodex')
-rwxr-xr-xscripts/rolodex17
1 files changed, 11 insertions, 6 deletions
diff --git a/scripts/rolodex b/scripts/rolodex
index fe386b3..cb658cc 100755
--- a/scripts/rolodex
+++ b/scripts/rolodex
@@ -51,6 +51,10 @@ readonly PROGNAME=$(basename "$0")
readonly OPEN=1
readonly CLOSED=0
readonly DRAWER_SIZE=15
+# This allows us to redefine using either 1.1 or 1.2 as the pane. I'm growing
+# more partial to having 1.1 as drawer to match tmux alt 3 layout
+readonly DRAWER_WINDOW_NUMBER="1.1"
+readonly MAIN_WINDOW_NUMBER="1.2"
get_active_pane(){
echo $(tmux lsp | grep '(active)' | cut -c 1)
@@ -73,7 +77,7 @@ get_prev_pane() {
if [[ "$PANE_COUNT" == '2' ]]; then
BUFFER_COUNT=$(get_number_of_buffer_window_panes)
ACTIVE_PANE=$(get_active_pane)
- tmux swap-pane -s 1.2 -t 2."$BUFFER_COUNT"
+ tmux swap-pane -s "${DRAWER_WINDOW_NUMBER}" -t 2."$BUFFER_COUNT"
MAX=$((BUFFER_COUNT - 1))
for i in $(seq 1 "$MAX" | tac); do
NEXT=$((i + 1))
@@ -88,7 +92,7 @@ get_next_pane() {
if [[ "$PANE_COUNT" == '2' ]]; then
BUFFER_COUNT=$(get_number_of_buffer_window_panes)
ACTIVE_PANE=$(get_active_pane)
- tmux swap-pane -s 1.2 -t 2.1
+ tmux swap-pane -s "${DRAWER_WINDOW_NUMBER}" -t 2.1
MAX=$((BUFFER_COUNT - 1))
for i in $(seq 1 "$MAX"); do
NEXT=$((i + 1))
@@ -106,7 +110,7 @@ close_drawer() {
if [[ "$WINDOW_COUNT" == '1' ]]; then
tmux new-window
fi
- tmux move-pane -s 1.2 -t 2.1
+ tmux move-pane -s "${DRAWER_WINDOW_NUMBER}" -t 2.1
tmux move-pane -s 2.1 -t 2.2
if [[ "$WINDOW_COUNT" == '1' ]]; then
tmux kill-pane -t 2.2
@@ -121,11 +125,12 @@ open_drawer() {
WINDOW_COUNT=$(get_number_of_windows)
if [[ "$WINDOW_COUNT" == '1' ]]; then
tmux split-window -c '#{pane_current_path}'
-
else
tmux move-pane -s 2.1
+ # Hardcoded swap for having the pane on top
+ tmux swap-pane -t 1.2 -s 1.1
fi
- tmux resize-pane -t 1.2 -y "${DRAWER_SIZE}"
+ tmux resize-pane -t "${DRAWER_WINDOW_NUMBER}" -y "${DRAWER_SIZE}"
fi
}
@@ -152,7 +157,7 @@ toggle_drawer() {
create_new_pane() {
tmux split-window -c '#{pane_current_path}'
- tmux resize-pane -t 1.2 -y "${DRAWER_SIZE}"
+ tmux resize-pane -t "${DRAWER_WINDOW_NUMBER}" -y "${DRAWER_SIZE}"
}
main() {