I absolutely despise the following directories: Documents, Music, Pictures, Public, Templates, Videos. Why? Because applications randomly dump stuff into these directories and fill them with junk files. I don't want any application putting anything into directories I actually use, unless I explicitly tell them to. It is not possible to keep your files organized if applications randomly dump trash files into them.
Most the default installation path is Program Files. That needs elevation to write to. Fine when you’re installing something, but not something you want to need just to run the game.
Writing to %APPDATA% or really anywhere in %USERHOME% is guaranteed to have the right permissions for this user.
Granted, a lot of home PCs and gaming PCs are single-user environments. The “personal” computer. In that case there’s no reason games and applications can’t be installed in %LOCALAPPADATA%, and in fact, I think windows has an environment variable or registry setting for that.
It’s no different in Linux. You don’t want users writing to /etc. And you may expect multiple users. So all of that stuff goes to dot files in $HOME.
Why can’t the save game and config.ini just be in the main god damn game directory?
You'd lose all save games every time you uninstall the game. We already had that in DOS/Win9x days and I am very happy that we moved away from this. Static program data and generated data should be clearly separated.
In Linux we have the XDG Base Directory spec for that, that gives you directories for cache, config, state and data, so everything is nicely separated. The only problem is that not every app follows it,
bug reports can help.
I find Android handles this by far the worst. They have the core right idea with permissions that makes it impossible for games to write outside of their assigned directories, but the way they handle it your savegames go into an area that will be deleted when you uninstall the app. So the risk of losing savegames is extremely high. The alternative is that games require SD card permissions and than just write wherever they want. It's basically all just a dark pattern to force games into using the Google Play service for cloud saves. Games that lose state and restart when you switch apps are also great.
I have my own directories on windows. I never use system provided directories for my own stuff, it always sucks. And if I want to move directories between drives or just change permissions, all hell breaks loose because everything depends on the default locations... So I just leave them be if I can.
These places are a cesspool of junk in every system, it's incredible. MacOS has this kind of shit too, just like Windows, with apps dumping crap there without a care.
Those bugs and PRs would just get closed without comment. Nobody is going to move a dotfile as a breaking change in any established software. You either get it right the first time or probably never.
Nobody is going to move a dotfile as a breaking change in any established software
We have oodles of counterexamples to this.
GIMP did it, Blender did it, DOSBox did it, Libreoffice did it, Skype did it, Wireshark did it, ad nauseum.
It's not really as big a deal as you make it to be (or a big deal at all).
You have a transitional period where you look for config files in both locations, and mark the old location as obsolete.
In the old days (I'm 50+) tumbleweed drifted through ~/ apart from my drivel and I'd have a folder for that so /home/gerdesj/docs was the root of my stuff. I also had ~/tmp/ for not important stuff. I don't have too much imagination and ~/ was pretty clean. I was aware of dot files and there were a shit load of them but I didn't see them unless I wanted to.
This really isn't the most important issue ever but it would be nice if apps dumped their shit in a consistently logical way. XDG is the standard.
I know developers are busy, and I don't mean to berate them for their choices or work. I only have a two year Computer Information Systems degree and haven't programmed a lot for a while, but supporting the XDG specification and remaining backwards compatible doesn't seem to be very difficult or would cause so much breakage (of course, the amount of work would depend on the software and how the hardcoded path is implemented). I look up git repository issues for the software and tend to find ubiquitous examples like vim to be resistant to such change: https://github.com/vim/vim/issues/2034
This is really frustrating and leads me to find alternative software, such as neovim/doom emacs instead of vim, nushell instead of bash, etc., just to be able to clear up my home directory. I don't mind if I have to wait for XDG to be supported, but many important projects just label the issue as "won't fix". I totally understand where you are coming from.
A (very well used) program I use places files in $HOME. Someone argued for changing to $XDG_CONFIG or at least add that as an option. The dev, being used to the old school way, gave the exact opposite reason: that .config was just an extra level of organization when dotfiles are what the home dir is for. So I'm not sure how successful you would be with that approach.
To be clear, I am clearly on the side of XDG, myself.
Why aren't all of these just normal directories under either .local (for data files) or .config (for configuration)???
Actually, I think the XDG directories should be under a single XDG directory either dotted or not (a better name would be OK with me) ~/xdg/Documents, ~/xdg/Music, ~/xdg/Pictures etc.
You might wanna backup your dotfiles somewhere remote too. I literally lost dotfiles that I'd been building up for years because I couldn't remember the password to my Linux machine after coming back from vacation. Funny enough though, a couple hours after nuking my OS I magically remember my password.
Unless you disk was encrypted, you could have booted up a live distro and back up the files you needed (or even overwrite the shadow file to get a new password)
In the late 90s I taught an intro course for folks who wanted to run *nix boxen (Solaris, IIRC). On the afternoon of the last day I had them swap places after lunch and gain root access to each others' machines. It was partly for root passwd recovery and other maintenance tasks, but also to demonstrate that physical access to the box was a serious issue.
After two years of typing in the same boot pass on my same laptop at my same job I woke up one day and couldn't remember it. Almost died trying. Right as I was reaching out to my admin it came to me.
Oof. Yeah, I once forgot my LastPass password literally less than 30 seconds after entering it on another device. Muscle memory versus active memory kind of thing.
They may not want their configuration stored in $HOME, for example:
they’re on a machine that isn’t under their physical control and ~/.config is mounted over the network from their personal machine;
That sounds like it's a bad way to handle configuration, since among many other problems, it won't work with the many programs that do have dotfiles in home directory, but even if that happened, you could just symlink it.
they prefer to version control their configuration files using git, with a configuration directory managed over different branches;
I do that. I symlink that config into a git-controlled directory. If OP plans to put his entire ~/.config in git, he is doing things wrong, because some of that needs to be machine-local.
the user simply wants to have a clean and consistent $HOME directory and filesystem
If whatever program you are using to view your home directory cannot hide those files, it is broken, as it does not work with a whole lot of existing software.
less secure,
If your home directory is "not secure", you're probably in trouble already.
Like, there are reasons you may not want to put dotfiles in a homedir, but none of the arguments in the article are them.
EDIT: I will ask developers to stop dumping directories and files that don't start with a dot in people's home directories, though. I gave up over twenty years ago and put my actual stuff under ~/m just to keep it from being polluted with all the other things that dump non-dotfiles/-dotdirs in a home directory. Looking at my current system, I have:
A number of directories containing video game saves and configuration. I am pretty sure that these are mostly bad Windows ports or possibly Windows programs under WINE that just dump stuff into a user's home directory there (not even good on Windows). Some are Windows Steam games.
WINE apparently has decided that it's a good idea to default to sticking the Windows home directory and all of its directories in there.
Apparently some webcam software that I used at one point.
Somehow I've never considered using git for version controlling/version synchronizing anything other than exclusively code... Brb gonna git all my files.
The rust library mentioned there doesn’t support system install paths for windows or macOS, it only uses XDG. I recommend the directories crate which properly supports Linux, Mac, and Windows.
You can manage symlinks pretty easy with home-manager. I'd personally setup symlinks for these app configuration directories if I don't want them storing files directly on the disk I use for $HOME. It's also done in a delcarative way that can persist across multiple computers.
Is there an easy way to learn this for just the package manager? Most of the tutorials I find are tailored to NixOS, which I'm not using and don't plan on using.
You can absolutely use nix and home-manager without NixOS, you can even use it on a Mac!
Most of the tutorials I find are tailored to NixOS
I think that's less true than you think. There's definitely a lot of tutorials from people who do use NixOS... But this mostly doesn't matter, using nix is more or less the same regardless of operating system. There is some stuff specific to NixOS, but that's mostly just using nix to configure system services.
Is there an easy way to learn this for just the package manager?
That said... There's not a super easy gateway to learning nix, unfortunately. The easiest way to learn is probably to try to package one of your personal projects, or by learning home-manager and trying to fully declare your home environment. Packaging programs in certain languages can involve having to learn more about the nix ecosystem than others (e.g., python is a little more complicated than what you'd need to package a simple C program, because python has it's own ecosystem that you have to integrate with).
Probably the best introduction is the nix pills if you want to learn how nix works (not necessarily how to use it, but it will give you a really solid foundation):
Though, it's really common for people to bounce off of the nix pills because they start kind of slow. If you can follow through them, though, you'll have a good understanding of the nix language and how it's used to construct derivations for building packages.
The nix language is much maligned, but it's actually not as bad as you think going in (error messages can be ATROCIOUS, however). It looks a bit weird, but I think if you go in with the understanding that it's "Turing Complete JSON" you'll have a better time. Almost everything you're doing in nix is building up attribute sets (which are basically just JSON dictionaries) which specify the dependencies and build stages of a project... But it's not a static representation like JSON, you can call functions to do arbitrary computations to build up fields (e.g., I have some functions to automatically set up wireguard configurations from a description of the network layout of my machines, so it's useful to be able to do this stuff).
For what it's worth, I don't understand the nix language or all the package manager functions in their entirety. I generally use what I need and that's it. Most information I've required that is nixpkgs-specific I was able to find in the manual. home-manager has one as well and it's been the best reference for me.
Tangentially related: I recently learned that there are tools for handling dotfiles such as chezmoi and yadm. I would suppose that after spending some time on backing up the dotfiles that matter one can purge the remainders without much issue. I also remember some tool that was made for the purpose of cleaning $HOME, but can not recall its name (if anyone knows please let me know).
I hate it when an application puts its configuration data in its own dotfile under $HOME instead in ~/.config. Also hate it when caches are stored in ~/.config, because then I have to manually tag those subdirectories for exclusion before doing a backup.
Is there any good gui application for mange these but also edit them in a user friendly way like getting a dropdown for a settings like: Yes/No, Country Sweden. Number size range etc. So include validation.
Even nix os does not have that.