Xdg-ninja: checking your $HOME for unwanted files and directories
13 comments
·March 6, 2025ChocolateGod
This is one of the reasons I like Flatpak, it can force misbehaving apps to not pollute my home folder with their hidden .folders that never get cleaned up on removal and instead go in a managed directory where it belongs.
asicsp
See also: "$HOME, Not So Sweet $HOME" https://gist.github.com/sharadhr/39b804236c1941e9c30d90af828...
porridgeraisin
I shall refrain from my usual XDG-hate rant, while still leaving this comment in here to potentially start the usual flamewar.
arcanemachiner
But why would anyone possibly hate XDG?!
hulitu
> Xdg
This is the crap responsible for poluting $HOME. If the user does not configure anything, just use global defaults.
rnhmjoj
I'm not sure how you came to that conclusion, but you got everything completely wrong.
First of all, writing state and configuration files in the home directory, without any well thought out structure, has been a common practice since UNIX existed, XDG did not even exist then.
Precisely because this lazy practice causes all sorts of problems, the cross-desktop group (XDG) came up with a standard called the "base directory specification"[1] which proposes to divide applications files into configuration, data, caches and are supposed to be stored in subdirectories named after the application in $XDG_CONFIG_HOME ($HOME/.config if unsed), $XDG_DATA_HOME ($HOME/.local/share if unset), $XDG_CACHE_HOME ($HOME/.cache if unset), respectively.
[1]: https://specifications.freedesktop.org/basedir-spec/latest/
bheadmaster
> This is the crap responsible for poluting $HOME.
I think people who wrote software used $HOME for dotfiles way before XDG even existed.
> If the user does not configure anything, just use global defaults.
And if he does, where do you put the dotfiles? $HOME? XDG defines an cleaner hierarchy.
oguz-ismail
This. Bring back configuration via environment variables
internet_points
Yes, I'd muuuch rather type `FONT_SIZE=7 FONT_FAMILY='DejaVuSans' FONT_WEIGHT=normal BG=black FG=pink FG_HL=blue BG_VISUAL=green THING='noremapsomething<vimscript>' vim` than polluting my home with a single ~/.config directory in which to put all my config files. And if that gets too long to type every time I start vim I can just make an alias and put it in a file and ..oh
cedilla
And when I change a setting in a program, where does it set that environment variable?
throw-the-towel
But why? I think a config file is way easier to understand.
> A shell script which checks your $HOME for unwanted files and directories.
IIUC, based on skimming some of the code, this seems to be for people who want to layout their home directory according to the conventions that the XDG group suggested [1], well into the history of Unix-y systems.
For example, a given tool, `foo`, might've originally created a `~/.foo/` directory, which `foo` still supports for backward compatibility, but `foo` now prefers XDG convention `~/.config/foo/`. `xdg-ninja` can inform you of that, and help you move the directory.
For another example, tool `bar` might still default to config file `~/.barrc`, but `xdg-ninja` might advise you to move it to XDG-like `~/.config/bar/rc`, and to set `bar`'s `BARRC` environment variable to point to that, even though `bar` doesn't use XDG conventions directly.
[1] https://specifications.freedesktop.org/basedir-spec/latest/