Skip to content

Commit

Permalink
Merge pull request #41 from erikw/support_xdg
Browse files Browse the repository at this point in the history
Support XDG Base Directory Specification for `$SIDEBAR_DIR`
  • Loading branch information
bruno- committed Dec 8, 2022
2 parents aacbdb4 + 9db9d43 commit a41d72c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion scripts/variables.sh
Expand Up @@ -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)"

0 comments on commit a41d72c

Please sign in to comment.