From b904f0b60edbbb92ab2ac701ef2f969f432c6e8f Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Tue, 6 Feb 2024 12:55:55 +0200 Subject: [PATCH] fix(shell): run tmux hook only if tmux is active --- base/zshrc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/base/zshrc b/base/zshrc index eaba2aa..f04ae0d 100755 --- a/base/zshrc +++ b/base/zshrc @@ -85,14 +85,18 @@ x-have rbenv && { eval "$(rbenv init - zsh)" } -# Autoupdate tmux window name -TMUX_WINDOW_NAME_PLUGIN="$DOTFILES/config/tmux/plugins/tmux-window-name/scripts/rename_session_windows.py" -[ -f "$TMUX_WINDOW_NAME_PLUGIN" ] && { - tmux-window-name() - { - ($TMUX_WINDOW_NAME_PLUGIN &) +# Run only if tmux is active +[[ -n "$TMUX" ]] && { + # Autoupdate tmux window name + TMUX_WINDOW_NAME_PLUGIN="$DOTFILES/config/tmux/plugins/tmux-window-name/scripts/rename_session_windows.py" + [ -f "$TMUX_WINDOW_NAME_PLUGIN" ] && { + tmux-window-name() + { + ($TMUX_WINDOW_NAME_PLUGIN &) + } + add-zsh-hook chpwd tmux-window-name + tmux-window-name } - add-zsh-hook chpwd tmux-window-name } # eval "$(starship init zsh)"