Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
XDG variables not set?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
sicr0
Apprentice
Apprentice


Joined: 23 Mar 2022
Posts: 179

PostPosted: Thu Jan 26, 2023 6:00 pm    Post subject: XDG variables not set? Reply with quote

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
View user's profile Send private message
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2719

PostPosted: Thu Jan 26, 2023 6:17 pm    Post subject: Reply with quote

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
View user's profile Send private message
Banana
Veteran
Veteran


Joined: 21 May 2004
Posts: 1392
Location: Germany

PostPosted: Thu Jan 26, 2023 6:19 pm    Post subject: Reply with quote

Not setting $XDG_CONFIG_HOME results in a default: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

If you really want to change it: https://forums.gentoo.org/viewtopic-t-859392-start-0.html

Edit: Ionen was faster
_________________
My personal space
My delta-labs.org snippets do expire

PFL - Portage file list - find which package a file or command belongs to.
Back to top
View user's profile Send private message
sicr0
Apprentice
Apprentice


Joined: 23 Mar 2022
Posts: 179

PostPosted: Thu Jan 26, 2023 7:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21633

PostPosted: Thu Jan 26, 2023 7:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2719

PostPosted: Thu Jan 26, 2023 7:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
sicr0
Apprentice
Apprentice


Joined: 23 Mar 2022
Posts: 179

PostPosted: Fri Jan 27, 2023 2:19 am    Post subject: Reply with quote

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
View user's profile Send private message
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2719

PostPosted: Fri Jan 27, 2023 11:21 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum