View previous topic :: View next topic |
Author |
Message |
sicr0 Apprentice
Joined: 23 Mar 2022 Posts: 179
|
Posted: Thu Jan 26, 2023 6:00 pm Post subject: XDG variables not set? |
|
|
Hi,
After reading the XDG Base Directory Specification, I realized that, at least in my system (don't know if maybe I've misconfigured something), the $XDG_CONFIG_HOME variable and co. aren't set by default. Is it normal?
Does Gentoo not follow the specification, or is there maybe a package that I'm missing? |
|
Back to top |
|
|
Ionen Developer
Joined: 06 Dec 2018 Posts: 2719
|
Posted: Thu Jan 26, 2023 6:17 pm Post subject: |
|
|
As it says in your link: Code: | If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used. | There is no need to set it if it's just going to be same as the default, it's what everything uses if not set or empty.
Some DE may set some these in their startup scripts though (unrelated to Gentoo). |
|
Back to top |
|
|
Banana Veteran
Joined: 21 May 2004 Posts: 1392 Location: Germany
|
|
Back to top |
|
|
sicr0 Apprentice
Joined: 23 Mar 2022 Posts: 179
|
Posted: Thu Jan 26, 2023 7:13 pm Post subject: |
|
|
Yea, I know that it should default to $HOME/.config.
That's why it caught my eye that it wasn't the case on my system.
Do you happen to know a possible reason why? |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21633
|
Posted: Thu Jan 26, 2023 7:29 pm Post subject: |
|
|
All compliant applications should treat it as $HOME/.config is not otherwise set, so there is no reason to explicitly set it to the same value as the default. Gentoo presumably considers the default path acceptable, so there is no need to set it to something else. |
|
Back to top |
|
|
Ionen Developer
Joined: 06 Dec 2018 Posts: 2719
|
Posted: Thu Jan 26, 2023 7:32 pm Post subject: |
|
|
It is the default to be used if unset, so there's nothing strange about it being unset ("if not set or empty" would have no meaning if it was always set).
For example, in a shell script you could read this variable as: Code: | echo "${XDG_CONFIG_HOME:-${HOME}/.config}" | So that if the variable is not set (or empty), it gives you the $HOME/.config "default" fallback, otherwise it gives you the variable's contents. |
|
Back to top |
|
|
sicr0 Apprentice
Joined: 23 Mar 2022 Posts: 179
|
Posted: Fri Jan 27, 2023 2:19 am Post subject: |
|
|
Ionen, so, if I type echo $XDG_CONFIG_HOME I shouldn't expect for it to be set. It's the programs who support it as default, not distribution.
Did I understood correctly? |
|
Back to top |
|
|
Ionen Developer
Joined: 06 Dec 2018 Posts: 2719
|
Posted: Fri Jan 27, 2023 11:21 am Post subject: |
|
|
Yes, if following the standard then programs are supposed to know to use ~/.config themselves if they're not specifically told to use anything else. |
|
Back to top |
|
|
|