From 12a2e62a9c93432ab2b2b1d6eacf5f7b366c90fc Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 26 Jan 2026 16:44:23 +0100 Subject: [PATCH] feat(tmux): add tmuxinator session to monitor deployments --- omz-custom/tmux-sessions.sh | 11 +++++++++++ tmux/bin/fuzzy-switch.sh | 12 ++++++++++++ tmux/tmux.conf | 1 - 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/omz-custom/tmux-sessions.sh b/omz-custom/tmux-sessions.sh index 43ca731..353b647 100644 --- a/omz-custom/tmux-sessions.sh +++ b/omz-custom/tmux-sessions.sh @@ -4,6 +4,17 @@ function tat() { ALL_PROJECTS=$(tls) IS_VALID_PROJECT=$(echo $ALL_PROJECTS | grep -io "[[:<:]]$SAFE_INPUT\w*" | head -1) if [[ $IS_VALID_PROJECT != "" ]]; then + if [[ "$IS_VALID_PROJECT" == "vrm-deploy" ]] && tmux has-session -t vrm-deploy 2>/dev/null; then + current_session=$(tmux display-message -p '#S' 2>/dev/null) + if [[ "$current_session" == "vrm-deploy" ]]; then + tmux rename-session -t vrm-deploy vrm-deploy-old + tmuxinator start vrm-deploy + tmux kill-session -t vrm-deploy-old 2>/dev/null + return 0 + else + tmux kill-session -t vrm-deploy 2>/dev/null + fi + fi tmuxinator start "$IS_VALID_PROJECT" return 1 fi diff --git a/tmux/bin/fuzzy-switch.sh b/tmux/bin/fuzzy-switch.sh index cac4e86..9614017 100755 --- a/tmux/bin/fuzzy-switch.sh +++ b/tmux/bin/fuzzy-switch.sh @@ -37,6 +37,18 @@ choice="$(printf '%s\n' "$sel" | sed -n '3p')" project="${choice:-$query}" [ -n "$project" ] || exit 0 +if [ "$project" = "vrm-deploy" ] && tmux has-session -t vrm-deploy 2>/dev/null; then + current_session=$(tmux display-message -p '#S' 2>/dev/null) + if [ "$current_session" = "vrm-deploy" ]; then + tmux rename-session -t vrm-deploy vrm-deploy-old + tmuxinator start vrm-deploy + tmux kill-session -t vrm-deploy-old 2>/dev/null + exit 0 + else + tmux kill-session -t vrm-deploy 2>/dev/null + fi +fi + tmuxinator start "$project" exit 0 diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 4d3e6b8..a838ba3 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -67,7 +67,6 @@ set -g @plugin 'omerxx/tmux-sessionx' set -g @plugin 'christoomey/vim-tmux-navigator' bind-key s display-popup -w 30% -h 30% -E "~/.config/tmux/bin/fuzzy-switch.sh" -bind-key f display-popup -w 30% -h 30% -E "~/.config/tmux/bin/fuzzy-switch.sh" # Initialise tmux plugin manager (needs to be at the bottom of the file) run '~/.config/tmux/plugins/tpm/tpm'