From e936451b03fd58cb3ae1f0e81c5c0230ee81b9b8 Mon Sep 17 00:00:00 2001 From: Yoni Weill Date: Mon, 6 Feb 2023 11:54:20 +0200 Subject: [PATCH] tmuxp: fix using workspace dirs other than ~/.tmuxp For reference see https://github.com/tmux-python/tmuxp/blob/3ba64262839da6a643a19e70bb990ca3e589ad16/src/tmuxp/workspace/finders.py#L99-L128 --- src/_tmuxp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/_tmuxp b/src/_tmuxp index 959234c..5407f20 100644 --- a/src/_tmuxp +++ b/src/_tmuxp @@ -139,11 +139,18 @@ __tmuxp_load() { # Can't get the options to be recognized when there are sessions that has # a dash. + local tmuxp_dir="${HOME}/.tmuxp" + local tmuxp_xdg_dir="${XDG_CONFIG_HOME:-${HOME}/.config}" + if [[ -d "${TMUXP_CONFIGDIR-}" ]]; then + tmuxp_dir="${TMUXP_CONFIGDIR}" + elif [[ -d "${tmuxp_xdg_dir}" ]]; then + tmuxp_dir="${tmuxp_xdg_dir}" + fi case $state in (sessions) local s _alternative \ - 'sessions-user:user session:compadd -F line - ~/.tmuxp/*.(json|yml|yaml)(:r:t)' \ + 'sessions-user:user session:compadd -F line - ${tmuxp_dir}/*.(json|yml|yaml)(:r:t)' \ 'sessions-other:session in current directory:_path_files -/ -g "**/.tmuxp.(yml|yaml|json)"' \ 'sessions-other:session in current directory:_path_files -g "*.(yml|yaml|json)"' ;;