Generally, good behaved applications have an entry in their man page that spells out these details for you, so you don't have to work out anything.
But since the use case is personal dotfiles, I imagine the user isn't going to forget that they set this up.
No, it doesn't. The point of modetc is precisely keep both myself and the programs happy: the files are actually stored where I like to keep them, but they can be accessed as if they were stored where the developer intended.
Ok, now you might have a dozen files which could contain the information, where the location of each file can be modified by environment variables. It's tolerable if you are working on something you change weekly, but a practical problem if you do it yearly or it's entirely new.
Of course, this doesn't help at all when software either doesn't have manpages, or doesn't include the list of files in the manpage. Just nitpicking your bash example.
When I'm searching for configuration file location, I do use '/FILES' or PgUp from the bottom of the manpage, so the length of the manpages is irrelevant.
Looks like it was based on a mid-2000s system called libetc, which did a similar job but had to be LD_PRELOADed: https://ordiluc.net/fs/libetc/
Also, completely unrelated to my motivation, someone pointed out that modetc could be used to quickly hotfix packages built with Nix. Say that you need to fix a CVE in openssl, normally that would require to rebuild all dependent packages, which takes a long time. Instead with something like modetc you could build just openssl and rewrite /nix/store/<hash>-openssl-3.6.0/ -> /nix/store/<hash>-openssl-3.6.0-hotfix/.
Another application might be replacing some configuration file with placeholders for secrets, with one file with the secrets substituted in, without having to modify it in place, possibly only for a specific UID. This is something you might find useful on NixOS.
I just treat ~ as a system-owned configuration area, and put my actual files (documents, photos, etc.) in a completely different hierarchy under /.
# XDG "compliant" programs
.config/ etc/
.local/state/ var/lib/
.cache/ var/cache/
This is the first I’ve heard of using ~/etc instead of ~/.config as $XDG_CONFIG_DIR. Is there any precedent for that?I didn't come up with this idea, though, I think I saw this in a reddit thread and started doing it myself: I like that the directories are visible and follow the usual structure.
~
├── bin binaries and scripts
├── etc configuration files
├── var
│ ├── lib program data
│ └── cache program caches
├── src git repositories
├── img pictures
├── mail email in maildir format
├── note text notes, todo
├── doc documents
└── down downloadsBut more I was thinking that having ~/bin ~/etc ~/src and so on is just clutter. I use ~/.local/{bin,build,lib} so it's compact and reduces clutter in my home
It's amusing that modetc goes through all this effort to twist dotfiles into the XDG half-solution, and here I am using symlinks through /dev/shm/xdg/* to warp XDG into sort-of working in an actual heterogeneous environment.
Because XDG by itself is a failure beyond trivial cases.