Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If everything honored this spec, including the part where it reads environment variables to see where the different directories are, you could do that by sticking the right variables in your environment.

I think the one legitimate exception to the rule is profile, because you need that in order to set the variables in the first place. So that one would somehow have to be hard coded to at least have a wider search path



Maybe your profile location ought to be something that you're able to set through chsh


Huh. So I was about to disagree because that felt like a kludge, but actually you're right; setting your shell and its environment are both things that have to be set before the user's normal environment is working for bootstrapping reasons, so yeah, it does make perfect sense to cover both with the same mechanism. Or maybe to make it more generic we could replace the "shell" line in passwd with a "login command" entry, which is always executed by the system /bin/sh with the system environment from /etc/profile? Then you could set it to `XDG_CONFIG_HOME=$HOME/mydotfiles /bin/shell`, or `/bin/decrypt-my-home; export XDG_CONFIG_HOME=$HOME/Library/config; exec /bin/bash --init-file $HOME/Library/bash/bashrc` or whatever you want.


There is a system-wide /etc/profile or /etc/profile.d/

Likewise, zsh will look for /etc/zshrc

And zsh will actually look at

    $ZDOTDIR/.zshenv
    $ZDOTDIR/.zprofile
    $ZDOTDIR/.zshrc
    $ZDOTDIR/.zlogin
    $ZDOTDIR/.zlogout
So perhaps you can set the value of ZDOTDIR in one of the systemwide locations to use "$HOME/foo/bar/zsh/" and this way zsh will use ~/foo/bar/zsh/ as the location for the user specific .zshrc and other mentioned files for every user

https://eng.libretexts.org/Bookshelves/Computer_Science/Oper...

https://bash.cyberciti.biz/guide/Setting_system_wide_shell_o...

https://zsh.sourceforge.io/Intro/intro_3.html


Yep! On my real systems, my configured shell is a wrapper which sets ZDOTDIR and execs zsh from my nix profile.


Honestly, when your xdg list gets huge, apps should just use xdg out of the box... my /etc/profile is 35 lines of just xdg junk.


What the heck are you talking about? The XDG basedir spec is three variables. The user dir spec is more but those are not environement variables.



So that's not any fault of XDG, that's you forcing applications to use it when they apparently don't support it natively. That's either 15 or 19 lines of application bugs.


Reread what I said, "apps should just use xdg out of the box"


No, you said "when your xdg list gets huge, apps should just use xdg out of the box". But the link you shared shows only 4 lines in your xdg list. 4 lines is hardly huge.


Why should I have to maintain a list of applications that don't conform to the standard? I tried to, and the list keeps growing. I'm done screwing around with it, I don't care how cluttered my homedir gets anymore.


You could set the variables in a pam module, then you don’t need to worry about profile




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: