Setting XDG values

If I do ‘printenv’, I see that some $XDG_xxxx values are shown, others are not.

For instance, none of the settings in ~/.config/user-dirs.dirs are shown as set, even after I manually call xdg-user-dirs-update. Or does that just update the user-dirs.dirs file without actually creating the env variables?

By ‘shown as set’ I mean does not show up in the printenv listing or return a value with echo var.

I want to set up many of the standard settings .e.g. XDG_CONFIG_HOME. Where should I do this? Or does this distro rely on hardbaked defaults?

Thanks in advance

https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

There is no hardbaked defaults.

Read XDG Base Directory - ArchWiki for the essentials

Then possibly XDG user directories - ArchWiki

In the linked XDG user directories - ArchWiki, the last sentence of the opening paragraph ends with “… sets up a configuration file in $XDG_CONFIG_HOME/user-dirs.dirs (XDG_CONFIG_HOME defaults to ~/.config) that applications can read to find these directories.”

My “hardbaked” comment came from that. Although it’s not the distro that forces XDG_CONFIG_HOME to default to ~/.config, but any application that wants to use XDG_CONFIG_HOME, I guess.

Does this mean I should not try to set XDG_HOME, XDB_CONFIG_HOME, et al because XDG aware apps do the heavy lifting?

My intent on posting this question was originally to find where these setting SHOULD be made if I want to make them.

In my exploration, I found that the settings in ~/.config/user-dirs.dirs are NOT set if I query with echo/printenv, but are found if I query with xdg-user-dir. echo $TEMPLATES returns nothing on my system, xdg-user-dir TEMPLATES returns ~/Templates.

xdg-user-dir XDG_CONFIG_HOME returns ~/, not ~/.config. So there seems to be another set of environment variables that do not show with printenv/echo, but only can be found with xdg-user-dir.

my basic question: where should I set e.g. XDG_CONFIG_HOME? Or should I just not bother?

My personal preference - if it ain’t broke don’t fix

Given the sequence the configuration files are parsed

  1. ~/
  2. /etc/
  3. /usr/

I would look in /etc/xdg

 $ cat /etc/xdg/user-dirs.conf
# This controls the behaviour of xdg-user-dirs-update which is run on user login
# You can also have per-user config in ~/.config/user-dirs.conf, or specify
# the XDG_CONFIG_HOME and/or XDG_CONFIG_DIRS to override this
#

So according this file - the setting of XDG_CONFIG_HOME will alter the default behaviour - as I read it - set it if you know what you are doing - it would then be something like

export XDG_CONFIG_HOME=$HOME/.config

in a shellscript in /etc/profile.d

10-4 good buddy

XDG_CONFIG_HOME is not set explicitely, but the default ~/.config is used
If you for some reason are not happy with that, you need to set it (to something else).
But (rather rhetorical question): why would you even want to bother? :grinning:

I’m convinced! Thanks

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.