The goal
I'm running Arch Linux. I want to store all config/data/cache/state files in subdirectories of ~/local
, like so:
~
├── downloads
├── documents
└── local
├── data
├── state
├── config
└── cache
The attempt
In order to do this, I've set environment variables as follows:
# set up XDG directories
export XDG_DATA_HOME=$HOME/local/data
export XDG_CONFIG_HOME=$HOME/local/config
export XDG_STATE_HOME=$HOME/local/state
export XDG_CACHE_HOME=$HOME/local/cache
# enable compliance
export ZDOTDIR=$XDG_CONFIG_HOME/zsh
export HISTFILE=$XDG_STATE_HOME/zsh/history
This is currently placed in /etc/zsh/zshenv
(as I use zsh
), however, I've also tried placing this in ~/local/config/zsh/.zshenv
and only setting $ZDOTDIR
globally.
I can see the environment variables set in the shell:
% echo $XDG_CONFIG_HOME
# /home/myuser/local/config
% echo $ZDOTDIR
# /home/myuser/local/config/zsh
The problem
Many, but not all, programs that I run just don't seem to respect the variables I've set.
For instance, Hyprland
ignores $XDG_CONFIG_HOME
and creates a default configuration file at ~/.config/hypr/hyprland.conf
, despite ~/local/config/hypr/hyprland.conf
existing. It then reads the file it created and complains about my configuration not having been modified. The same applies to my terminal emulator, kitty
, which explicitly implements XDG Base Directory.
Other programs however, like tealdeer
and zsh
itself, respect the variables and put files in the directories I specified.
Why is software that supposedly supports the standard not changing behaviour based on the environment variables I set?
?
character.