-- Leo's gemini proxy

-- Connecting to tilde.pink:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini;

the xdg spec is cute


once upon a time, programmers would put everything in a "dotfile" in your home directory. meaning that, if you were to do, say, 'ls -a', everything would be a total mess of configs and data! the "XDG Base Directory Specification" eases the pain a little bit. i never realized how much i appreciated it before.


xdg defines a list of unix environment variables, and defines default values for them. here's the list:


$XDG_DATA_HOME $HOME/.local/share

$XDG_CONFIG_HOME $HOME/.config

$XDG_CACHE_HOME $HOME/.cache

$XDG_DATA_DIRS /usr/local/share:/usr/share

$XDG_CONFIG_DIRS /etc/xdg

$XDG_RUNTIME_DIR nil


i generally don't change any of these, as the defaults are pretty clean.


$XDG_DATA_HOME stores "data files", like, important stuff that you usually don't need to edit yourself, like font files and icons and binaries.


$XDG_CONFIG_HOME is for the config files (like 'rc' files). lots of programs search this directory before looking in your homedir for a config file, but check the manual pages for your program to see that in confines to xdg standards before putting your configs in here!


$XDG_CACHE_HOME is, well, a cache file, for stuff like file backups and history files. $XDG_DATA_DIRS is a list of directories to search for datafiles.


$XDG_CONFIG_DIRS is where xdg looks for config files that aren't in $XDG_CONFIG_HOME


$XDG_RUNTIME_DIR is, well... another cache dir, but it has requirements like "this file must have the permissions: 0700 and must be deleted when the user logs out", so i mean, i guess that's cool, but i never really looked at what it's supposed to do. i should read the spec more carefully i guess.


the point is, with xdg, instead of slapping everything in home or trying to use some kind of "standard but not really standard" dir for configs/data, you can use an *actual* standard that cleans up your home directory by a decent amount!


XDG Base Directory Specification


march 8, 2021

-- Response ended

-- Page fetched on Wed Apr 24 16:09:46 2024