From 7934b0d51b3c6dec49f9e5c7ea29093c23c2a35f Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 28 Feb 2026 17:01:11 +0100 Subject: [PATCH] Add tmux alt+arrow bindings if missing --- bin/omarchy-refresh-tmux | 5 +---- bin/omarchy-restart-tmux | 7 +++++++ migrations/1772294096.sh | 21 +++++++++++++++++++++ 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100755 bin/omarchy-restart-tmux create mode 100644 migrations/1772294096.sh 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