Live data from Hacker News

Show HN: boxxy – Control where Linux programs put files, without symlinks

github.com

211–220 of 250 posts

Re: Show HN: boxxy – Control where Linux programs put files, without symlinks

#212

I hate when applications ignore the XDG spec, but you know what I hate more? the XDG spec! I don't want all my pictures to go in Pictures, all my documents in Documents, etc. I want everything from each project to go in the directory for that project. I don't need it to read my mind, but when I save a document to a new directory and then I want to save a spreadsheet too... I want that new directory to be a top-line c…

What are you talking about? When people say the "XDG spec", they are usually referring to the XDG Base Directory Specification, but there are other specifications from XDG - are you talking about a different one? Because the XDG Base Directory Specification does not dictate about how files should be saved - whether in Pictures/, Documents/, or anything else...

https://www.freedesktop.org/wiki/Software/xdg-user-dirs/

Re: Show HN: boxxy – Control where Linux programs put files, without symlinks

#213
post #118

Earlier quoted context omitted.

The XDG base directory specification[0] was initially introduced in 2003; 20 years ago now. Yes there's plenty of software that existed before 2003 which didn't respect XDG, but most all of the Linux software dumping dotfiles in my homedir where written not just after 2003, but many years after 2003. For example, the following pieces of software all have dumped garbage in my homedir, and all are much less than 20 yea…

Sure, XDG was introduced in 2003, but why would you expect developers to start to follow its rules instantly? At best, it started to gain some traction 4 or 5 years after that, but still today, it is far from universally accepted. But take a step further back: why should anyone care about what the XDG says in first place? This isn't a dictatorship, and things were doing just fine long before a handful of people who w…

> But take a step further back: why should anyone care about what the XDG says in first place?

Because their users are asking them to not pollute the home directory? This isn't bikeshedding config locations without reason, there is a clear motivation for letting users a) specify where data should go and b) separate different types of data.

> It's been my observation that good standards can be adopted broadly and quickly with little controversy or need for advocacy.

The XDG basedir spec has been adopted broadly amongs many organizations and individual devlopers including all major desktop environments. It is not adopted universally yet, but few things are.

Re: Show HN: boxxy – Control where Linux programs put files, without symlinks

#214

Earlier quoted context omitted.

If only. There is a single base directory relative to which user-specific data files should be written. This directory is defined by the environment variable $XDG_DATA_HOME. There is a single base directory relative to which user-specific configuration files should be written. This directory is defined by the environment variable $XDG_CONFIG_HOME. Neither of those environment variables is defined on a stock Ubuntu 22…

$XDG_DATA_HOME defines the base directory relative to which user-specific data files should be stored. If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used. $XDG_CONFIG_HOME defines the base directory relative to which user-specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used. $XDG_S…

I like this system overall, but this particular aspect seems like a mistake [0] to me. Instead of a simple rule like "use these envars", it has this more complicated logic that must be replicated in all apps supported by all developers. Users would have more agency if they could inform apps of their preferences by simply setting some envars. [1] If this simpler, more user-friendly regime had been in the spec, we would have seen better adoption initially and also two decades later.

[0] of course one shouldn't assume that a totalitarian decision is a mistake, because it's just as likely that the decision-maker has priorities other than "support users"

[1] yes of course users have agency with respect to where XDG is implemented, but the simpler rule would also have given them agency with respect to whether it is implemented

Re: Show HN: boxxy – Control where Linux programs put files, without symlinks

#215

Earlier quoted context omitted.

If only. There is a single base directory relative to which user-specific data files should be written. This directory is defined by the environment variable $XDG_DATA_HOME. There is a single base directory relative to which user-specific configuration files should be written. This directory is defined by the environment variable $XDG_CONFIG_HOME. Neither of those environment variables is defined on a stock Ubuntu 22…

$XDG_DATA_HOME defines the base directory relative to which user-specific data files should be stored. If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used. $XDG_CONFIG_HOME defines the base directory relative to which user-specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used. $XDG_S…

And the variables should not be set if the user/distro wants the default (probably to force developers to handle the default case which is needed for compatibility anyway).

Re: Show HN: boxxy – Control where Linux programs put files, without symlinks

#216
post #113

Earlier quoted context omitted.

A hidden file, even. Stop using "ls -A" and you'll be fine.

To be pedantic, if we're going to cite Unix history, then technically there is no such thing as a "hidden" file. As I understand, the original implementation of tools like ls would not show the current directory "." in the listing. The quickest way of doing this in C was checking whether dentry.name[0] == '.' This also had the side effect of hiding entries that had names beginning with ".", and over time an implement…

Who cares how the feature of hidden files came to be, when it has been what it is now for so many years?

Re: Show HN: boxxy – Control where Linux programs put files, without symlinks

#217

Earlier quoted context omitted.

The XDG base directory specification[0] was initially introduced in 2003; 20 years ago now. Yes there's plenty of software that existed before 2003 which didn't respect XDG, but most all of the Linux software dumping dotfiles in my homedir where written not just after 2003, but many years after 2003. For example, the following pieces of software all have dumped garbage in my homedir, and all are much less than 20 yea…

But why should developers conform to that specific standard, if (for them, and many of their users) it makes more sense to use a "~/.wine" (or whatever other) folder? If i want to completely remove wine from my profile, how many folders do I have to delete doing it the old way? One - ~/.wine. How many using the new? One in .config, then .local/share, probably one in .cache... oh wait, .local/state too.. Probably.. we…

Whenever I install directly instead of using e.g. apt (typically because I want a more current version than the distro has), I use GNU stow [0], for precisely this reason. It works at the system level, at the user level, within projects, wherever. A simple "stow -D" is all it takes to clean out all the directories.

[0] https://www.gnu.org/software/stow/

Re: Show HN: boxxy – Control where Linux programs put files, without symlinks

#218

Earlier quoted context omitted.

> They're the ones maintaining the damn things, the least we can do is respect them. we don't respect maintainers who leave in buffer overruns or x-site scripting, why should we respect maintainers who don't respect users? yes, they're writing and maintaining, but undoubtedly also using tons of respectful opensource that other maintainers take care of. it's like driving a car ("everybody faster than me is a maniac, e…

> why should we respect maintainers who don't respect users? Saying that using dotfiles instead of ~/.config means they "don't respect users" is a little dramatic, don't you think? Like it or not, unix has historically treated dotfiles as "hidden" and nobody expects you to get upset that they created a hidden file in your home directory without your consent. It's not really about respect, it's just convention you app…

> Saying that using dotfiles instead of ~/.config means they "don't respect users" is a little dramatic, don't you think?

No I don't think so. For many applications (i.e. only config, no cache) it's literally an additional getenv and minimal logic when opening your config files. No additional dependencies needed. The amount of effort required is tiny compared to the benefit multiplied by the number of users that don't want dotfiles in their $HOME.

Re: Show HN: boxxy – Control where Linux programs put files, without symlinks

#219

Earlier quoted context omitted.

What are the competing standards to XDG? Stick everything in $HOME? Stick everything in $HOME/.config? Those 2 aren't standards and aren't helpful.

Yes, sticking everything into `$HOME/.toolname` is what most cross-platform software is doing, and I imagine that's just fine for the vast majority of users.

Except it isn't most cross-plaform software doing that. It might be most of the cross-platform software you use but IME it's mostly it's corporate software plus a few holdouts too stubborn to add two lines to the code reading their config file.

Re: Show HN: boxxy – Control where Linux programs put files, without symlinks

#220
post #134

Earlier quoted context omitted.

Yeah. It annoys me to no end that the new powershell didn't take the opportunity to move the config out of My Documents and into roaming app data which in theory is where that sort of file should be. It's things like that which have made me give up on %USERPROFILE% (and to a lesser extent $HOME), and I now put my files that I care about into a completely separate folder outside of the normal hierarchy.

Could you elaborate on that? I too am quite unhappy with the mess my %USERPROFILE% has become.

Oh, it's really not anything impressive. I've just decided to treat %USERPROFILE% as for machine generated files only. I then have a new directory on C: where I put my documents/projects/etc (all in appropriate sub folders).

My config files are a bit more interesting, and are stored in a chezmoi[^1] repo. If I tinker with a program enough, I generally move its config into there so I can keep track of it and the changes (to make this easier I have a bat file in shell:sendto to add files/folders to chezmoi).

Thinking about this, I should probably move the chezmoi repo into my personal directory, and symlink it back to it's normal location.

[1]: https://www.chezmoi.io/

Post reply on HN