diff --git a/bin/omarchy-refresh-tmux b/bin/omarchy-refresh-tmux index 64c7f9f2..560c7fd5 100755 --- a/bin/omarchy-refresh-tmux +++ b/bin/omarchy-refresh-tmux @@ -3,7 +3,4 @@ # Overwrite the user tmux config with the Omarchy default and reload tmux. omarchy-refresh-config tmux/tmux.conf - -if pgrep -x tmux; then - tmux source-file ~/.config/tmux/tmux.conf -fi +omarchy-restart-tmux diff --git a/bin/omarchy-restart-tmux b/bin/omarchy-restart-tmux new file mode 100755 index 00000000..b1ce7603 --- /dev/null +++ b/bin/omarchy-restart-tmux @@ -0,0 +1,7 @@ +#!/bin/bash + +# Restart tmux if running with the latest configuration + +if pgrep -x tmux; then + tmux source-file ~/.config/tmux/tmux.conf +fi diff --git a/migrations/1772294096.sh b/migrations/1772294096.sh new file mode 100644 index 00000000..b00383dc --- /dev/null +++ b/migrations/1772294096.sh @@ -0,0 +1,21 @@ +echo "Add Alt+Arrow keybindings for tmux window and session navigation" + +TMUX_CONF=~/.config/tmux/tmux.conf + +if [[ -f $TMUX_CONF ]]; then + # Add M-Left/M-Right after M-9 if not present + if ! grep -q "bind -n M-Left select-window" "$TMUX_CONF"; then + sed -i '/bind -n M-9 select-window -t 9/a\ +bind -n M-Left select-window -t -1\ +bind -n M-Right select-window -t +1' "$TMUX_CONF" + fi + + # Add M-Up/M-Down after "bind N switch-client -n" if not present + if ! grep -q "bind -n M-Up switch-client" "$TMUX_CONF"; then + sed -i '/^bind N switch-client -n$/a\ +bind -n M-Up switch-client -p\ +bind -n M-Down switch-client -n' "$TMUX_CONF" + fi + + omarchy-restart-tmux +fi