3

I'm referring to: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

I have the following files in my .config directory:

~/.config/user-dirs.dirs:

# ...
XDG_DOWNLOAD_DIR="$HOME/downloads"
# ... there are only comments in this file, except the line above ...

(I guess this file needs to be sourced somewhere? But where and how?)

~/.config/user-dirs.conf:

enabled=False

(This file seems to be necesseary to prevent xdg-user-dirs-update from overwriting ~/.config/user-dirs.dirs.)

However, $XDG_DOWNLOAD_DIR is not set when I run a shell.

Where/How are the XDG*DIR user directory variables supposed to be set?

Am I supposed to source ~/.config/user-dirs.dirs in one of the files sourced by my login shell (e.g. in .bash_profile)?

1 Answer 1

4

set it this way

xdg-user-dirs-update --set DOWNLOADS ${HOME}/Downloads;

update all xdg dirs

xdg-user-dirs-update;

source ${HOME}/.config/user-dirs.dirs;
2
  • 1
    source ${HOME}/.config/user-dirs.dirs in .bash_profile?
    – anick
    Jul 5, 2022 at 21:12
  • 2
    as you want in .bashrc for terminal sessions (interactive shell) or /and inside scripts , yes you should source it in all cases ! OR this way to get a specific var xdg-user-dir DOWNLOADS
    – Yunus
    Jul 5, 2022 at 22:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .