diff --git a/config/tmux/tmux.conf b/config/tmux/tmux.conf index 56f0ac87..2b0ddb0d 100644 --- a/config/tmux/tmux.conf +++ b/config/tmux/tmux.conf @@ -43,6 +43,8 @@ bind -n M-9 select-window -t 9 bind -n M-Left select-window -t -1 bind -n M-Right select-window -t +1 +bind -n M-S-Left swap-window -t -1 \; select-window -t -1 +bind -n M-S-Right swap-window -t +1 \; select-window -t +1 # Session controls bind R command-prompt -I "#S" "rename-session -- '%%'" diff --git a/migrations/1772379119.sh b/migrations/1772379119.sh new file mode 100644 index 00000000..12e10134 --- /dev/null +++ b/migrations/1772379119.sh @@ -0,0 +1,13 @@ +echo "Add Alt+Shift+Arrow keybindings for swapping tmux windows" + +TMUX_CONF=~/.config/tmux/tmux.conf + +if [[ -f $TMUX_CONF ]]; then + if ! grep -q "bind -n M-S-Left swap-window" "$TMUX_CONF"; then + sed -i '/bind -n M-Right select-window -t +1/a\ +bind -n M-S-Left swap-window -t -1 \\; select-window -t -1\ +bind -n M-S-Right swap-window -t +1 \\; select-window -t +1' "$TMUX_CONF" + fi + + omarchy-restart-tmux +fi