#1036290 Support ~/.config; set ZDOTDIR in zshenv

Package:
zsh
Source:
zsh
Description:
shell with lots of features
Submitter:
Jörg Sommer
Date:
2023-05-18 17:33:04 UTC
Severity:
normal
#1036290#5
Date:
2023-05-18 17:29:36 UTC
From:
To:
Hi,

what's your opinion about the following patch for /etc/zsh/zshenv? It sets
ZDOTDIR to ~/.config/zsh if a Zsh config file exists in this directory. This
gives Zsh support for the XDG directory standard.

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

```diff
--- /tmp/zshenv 2023-05-18 19:16:39.134041352 +0200
+++ debian/zshenv       2023-05-18 19:16:57.286240552 +0200
@@ -16,3 +16,10 @@
 then
        export PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
 fi
+
+if [[ -z ${ZDOTDIR:-} &&
+  -z $(echo $HOME/.(zlogin|zlogout|zprofile|zshenv|zshrc)(N)) &&
+  -n $(echo ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/.(zlogin|zlogout|zprofile|zshenv|zshrc)(N)) ]]
+then
+    ZDOTDIR=${XDG_CONFIG_HOME:-$HOME/.config}/zsh
+fi
```

Kind regards Jörg