From 2b02ee50b49e0da4292f26cef17a7941995b33ae Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Thu, 17 Feb 2022 15:54:02 +0100 Subject: [PATCH] zsh:zprofile: Use $XDG_CONFIG_HOME for tmux config --- .config/zsh/.zprofile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile index b71979d..61c475c 100644 --- a/.config/zsh/.zprofile +++ b/.config/zsh/.zprofile @@ -109,15 +109,16 @@ fi if (( $+commands[tmux] )) && [[ (-n $SSH_CLIENT || -n $SSH_TTY || -n $SSH_CONNECTION) && -z $TMUX ]] then - num_sessions="$(tmux list-sessions 2>/dev/null | wc -l)" + TMUX_CMD=(tmux -f "${XDG_CONFIG_HOME:-$HOME/.config}/tmux/tmux.conf") + num_sessions="$("${TMUX_CMD[@]}" list-sessions 2>/dev/null | wc -l)" if (( ! num_sessions )); then - tmux + "${TMUX_CMD[@]}" elif (( num_sessions == 1 )); then - tmux attach + "${TMUX_CMD[@]}" attach else - tmux attach\; choose-tree -Zs + "${TMUX_CMD[@]}" attach\; choose-tree -Zs fi - unset num_sessions + unset TMUX_CMD num_sessions fi