1

I want to change the location of .xinitrc, .zshrc and .zshenv to ~/.config/x/xinitrc, ~/.config/zsh/zshrc and ~/.config/zsh/zshenv, but without simlinking them.

How can I achieve this? Do I have to change files that source these configuration files in /etc? Thank you in advance!

2 Answers 2

2

Both xinit and zsh can be told where to find their respective rc files with environment variables: XINITRC for xinit and ZDOTDIR for zsh (for the directory where to find .zshrc, .zshenv, .zlogin, .zlogout, .zcompdump...).

So you could try and seed the environment with those upon login.

For instance, if using a GNU/Linux distribution and the pam_env env modules, you could have:

XINITRC DEFAULT=@{HOME}/.config/x/xinitrc ZDOTDIR DEFAULT=@{HOME}/.config/zsh 

in /etc/security/pam_env.conf

Or:

XINITRC=/home/you/.config/x/xinitrc ZDOTDIR=/home/you/.config/zsh 

In your ~/.pam_environment (see the pam_env man page for how to change the path of that one as well).

0

i think you don't like my way , but i think is useful

$ cat ~/.xinitrc source ~/.config/x/xinitrc 
$ cat ~/.zshrc source ~/.config/zsh/zshrc 

this methode is keeping your configs in any directory without using symlink

3
  • Why would this method be preferred over a symlink? Commented Nov 8, 2021 at 3:52
  • 1
    if use git with a symlink or some backup something does not work Commented Nov 8, 2021 at 18:43
  • Of course this still requires a file in the ~/.xinitrc location - instead of tidying up it means there are additional files. OP does not state his reasons for moving the files but he does want them moved not proliferated. Commented Jan 1 at 9:24

You must log in to answer this question.