diff --git a/scripts/variables.sh b/scripts/variables.sh index 9d7c3fc..e654882 100644 --- a/scripts/variables.sh +++ b/scripts/variables.sh @@ -23,4 +23,17 @@ TREE_WIDTH_OPTION="@sidebar-tree-width" SUPPORTED_TMUX_VERSION="1.9" -SIDEBAR_DIR="$HOME/.tmux/sidebar" +sidebar_dir() { + local DIR_XDG="${XDG_DATA_HOME:-$HOME/.local/share}/tmux/sidebar" + local DIR_OLD="$HOME/.tmux/sidebar" + + if [ -d "$DIR_XDG" ]; then + echo "$DIR_XDG" + elif [ -d "$DIR_OLD" ]; then + echo "$DIR_OLD" + else + echo "$DIR_XDG" + fi +} + +SIDEBAR_DIR="$(sidebar_dir)"