diff --git a/tmp b/tmp index 1666ac5..bffded1 100755 --- a/tmp +++ b/tmp @@ -52,13 +52,20 @@ done # Copy in template directory if [ -n "$1" ]; then - copydir="$HOME/Templates/tmp/$1" + # Source in XDG dirs, if they exist + userdirs="${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs" + if [ -f "$userdirs" ]; then + source "$userdirs" + fi + unset userdirs + copydir="${XDG_TEMPLATES_DIR:-~/Templates}/tmp/$1" if [ -d "$copydir" ]; then log "Using template \"$1\"" cp -r "$copydir"/* "$tmpdir" else log "Could not find template directory \"$copydir\"" fi + unset copydir fi trap "cleanup" EXIT