Lurker News

Comments (239) 44 threads

doodlesdev3 replies#
If anyone would like to actually force the non-compliant applications to do the thing correctly, then xdg-ninja is your friend [0]. The script looks at all the dotfiles in the home folder and tells you what environment variables you have to set to make them follow XDG base directory specifications, in the cases where that's not possible it will show you the related GitHub issue or similar bug tracking option with the problem.

My current dotfiles [1] already have a lot of these and they mostly just work. Once in a while an application won't respect it completely, and so instead of having a mess with xdg + whatever the dev though was cooler I just let the application do it's thing so at least is somewhat predictable.
[0]: https://github.com/b3nj5m1n/xdg-ninja
[1]: https://github.com/DoodlesEpic/Dotfiles/blob/main/.profile

klntsky1 reply#
Does it use a centralized database of all known software?
adhoc_slime7 replies#
Hah I was literally just complaining about applications not following the XDG directory spec today.

there's a non-exhaustive list of applications on the archwiki [0] that put their config/data in dotfiles in the home directory. surprisingly, there's also lots of pushback from maintainers of projects who don't want to change this, for whatever excuse they can produce. a Reddit thread has some list of issues where the change is brought up [1].
Anyway, I'll look forward to testing this out.
[0] https://wiki.archlinux.org/title/XDG_Base_Directory
[1] https://www.reddit.com/r/linux/comments/971m0z/im_tired_of_f...

NoboruWataya#
Yep, this does my head in. I really feel like there's no excuse for it in 2023.
inanutshellus3 replies#
Can I also soapbox about the XDG_CONFIG_HOME (~/.config) folder having gigs of temp data in it?

(I'm looking at you, Slack!)
How awesome would it be to be able to back up my custom app configs just by copying around one tiny folder? Or throwing it in a git repo and knowing what config changed when? :\

vngzs2 replies#

    $ du -sch ~/.config/Slack
    846M $HOME/.config/Slack
    846M total
... this is on a two day old machine. WTF, Slack? Junk cached data belongs in ~/.local/share ($XDG_DATA_HOME), not ~/.config.
deadbunny#
I think you mean `~/.cache`.
Already__Taken4 replies#
a bunch of windows stuff does this too putting config in appdata/local and huge cache assets in appdata/roaming. anything that depends on good behaviour is doomed imo like Google wave circles

Continue this thread — 4 replies

toastal1 reply#
Should've kept Slack in a containered in a browser tab where it belongs so it can't go messing with your system or prevent you from blocking their tracking.
boosteri#
And then I've seen websites hoggi g gigs of local storage after you visit them once a blue moon. The trend is blatantly towards no optimization whatsoever. Apart from profits and squeezing the last drop off your customers by any means necessary
joshuaissac1 reply#
Some of these programs also spam the home folder on Windows instead of using the path specified in the %APPDATA% environment variable.
remram#
Some also put it in %HOMEPATH%/.name because they are bad ports from Unix. I'd argue that it's better than in My Documents though.
ajsnigrutin9 replies#
The dotfiles and dotfolders directly in the home folder is "the way it was always done", and now some "new kids" came and want changes done to software which has existed before they were even born. People have muscle memory for those folders, some have hardcoded those paths in other scripts, others just don't care, and things stay as they always were.

On one hand, it's great to have all the stuff in the same place, on the other hand, we used to have this, before the ~/.config folder too.
Also, it's not just in one place anymore, but in many places -- so to completely remove a programX, it's not enough to just remove ~/.programX, but you need to remove a folder from ~/.config/, and another one from ~/.local/something, and another form ~/.cache,...
So yeah, i understand 'the old guys' too... maybe because i'm not 20-something anymore.

lelandbatey5 replies#
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 years (or even 15 years) old:

    vault
    flyctl
    yarn
    npm
    vscode
    terraform
    rustup
    kubernetes
    fzf
    eclipse
    docker
    cargo
    aws (cli)
There's no excuses for these programs not respecting standards that are 1. Well established by the time the software was written and 2. short (seriously, the standard's contents fit entirely on three A4 pieces of paper)

[0] - https://specifications.freedesktop.org/basedir-spec/basedir-...

ajsnigrutin2 replies#
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.. well, maybe, I'd have to check manually. Same for other software. One folder to remove, one folder to backup, one folder to restore.

Continue this thread — 2 replies

cube22225 replies#
If, as you say

> most all of the Linux software dumping dotfiles in my homedir
then is it really true, that the standard is in fact "well established"?

Continue this thread — 5 replies

Animats3 replies#
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.04.1 LTS.

Continue this thread — 3 replies

__d1 reply#
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 wrote the XDG thought their ideas were the best approach.
It's been my observation that good standards can be adopted broadly and quickly with little controversy or need for advocacy. The fact that the XDG file layout still isn't universally used suggests it doesn't have as much value as its proponents think.

Continue this thread — 1 reply

matheusmoreira5 replies#
> There's no excuses for these programs not respecting standards that are 1. Well established by the time the software was written and 2. short

This isn't a standard, it's a convention at best. A freedesktop.org specification. Basically a scheme Red Hat people thought up and implemented widely in the open source software projects they control. It may be a useful abstraction but there's absolutely no obligation to conform to it. There doesn't have to be an "excuse" or any form of justification at all. "I just don't like it" is enough. I don't like those unsightly XDG variables either and it's entirely within my power as a software developer to trash the entire concept of XDG and do things in any way I see fit.
https://www.freedesktop.org/wiki/Specifications/
> freedesktop.org produces specifications for interoperability, but we are not an official standards body.
> There is no requirement for projects to implement all of these specifications, nor certification.

Continue this thread — 5 replies

saulrh1 reply#
The really fun part is when you have a program that has ~/.programX, but also ~/.programXy, ~/.programX_cache, ~/.programxrc, ~/.programx_init, ~/.programx/a_whole_directory, ~/.otherthing, ~/.maybe_a_database_for_good_measure.sqlite, ~/.and_the_kitchen_sink_too. And that's not even getting into questions like "can I nuke ~/.programX_db to clear the program's cache without losing my configurations?". I agree that the XDG spec isn't an improvement for programs that have _precisely_ one config file, but it's a _major_ improvement for programs that need multiple config files, config directories, separate configs and caches, and more, and it's not a _regression_ from single-file configs.
ajsnigrutin9 replies#
That's why that kind of software uses a .programX directory, where everything like that can be put in.

Look at ~/.wine for example... config files, whole C drive, everything in one simple folder. Want to upgrade to an alpha version to test something, but don't want to break anything that's now working? Just backup that one single folder. Restore or migrate configuration to another computer? One single folder. Remove any trace of that app? Again, one simple folder.
Want to do the same with google chrome? .config/google-chrome... oh wait, what if there's something in .local too? Still doesn't work? Oh wait, you forgot the .cache directory, and have been loading an old version of something.

Continue this thread — 9 replies

brigandish1 reply#
> some have hardcoded those paths in other scripts

My sympathy is lacking, as is my respect for those running projects that hardcode paths. Stop hardcoding paths and the world will be a better place.

ajsnigrutin10 replies#
eg. ~./bashrc has existed there for 30+ years, changing stuff just because someone doesn't like seeing a file in a folder is imho stupid.

Continue this thread — 10 replies

OJFord#
> Also, it's not just in one place anymore, but in many places -- so to completely remove a programX, it's not enough to just remove ~/.programX, but you need to remove a folder from ~/.config/, and another one from ~/.local/something, and another form ~/.cache,...

OTOH if you want to completely remove your cache, or completely backup your config...

matheusmoreira1 reply#
I don't see the problem. There's no reason to choose one or the other when we can have both. Many programs try several options. Git for example tries ~/.gitconfig and ~/.config/git/config.

Do people seriously resist such non-destructive improvements just because they think it's offensive when younger programmers have opinions on legacy software?

renewiltord7 replies#
Personally I see a lot of young people use emacs and BSD licences, but because I'm an older engineer and have the wisdom and experience of time, I use vim and GPL.

Continue this thread — 7 replies

Continue this thread — 4 more replies

Continue this thread — 3 more replies

fsckboy5 replies#
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 choice, but I want the old directory there too.
Doesn't everybody work like me? (asking seriously)
and hey, call me a freak, but I still get the odd sort of picture that I don't want showing up on the lock screen screensaver

its-summertime1 reply#
hypothetical, but, could easily make a script that, upon cd, checks all above directories for `.xdg-root`, and while inside, has envvars set to use said folder as a root for Documents/Pictures/Etc folders
fsckboy#
not a terrible idea, has some good points, but gui apps don't cd in a way that can be hooked, and usually i get around to popping a terminal window after i'm working on a project rather than before. (also, cd isn't so easy to script, I'd have to use a bash function, but i'd probs have to make a up new name to get used to, cdproj or something, otherwise any "headless" scripts would be do it too

And I frequently jump from desktop to desktop for multiple projects, and my terminal on that desktop is likely to already be where I want to be. Do gui apps reliably reload xdg all the time, or only at startup?
anyway, keeping it in mind, it might just be worth the trouble to click a scripted icon on each desktop :)

tadfisher1 reply#
You can set the XDG environment variables in Direnv maybe?
account42#
The Desktop, Downloads, Pictures, etc. directories are not from the XDG Basedir spec and not set by XDG_ environment variables but instead in the $XDG_CONFIG_HOME/user-dirs.dirs file. I also find these less useful than the more generel data/config/cache dirs.
fomine31 reply#
Also I hate localized XDG directories. Windows and macOS don't localize real directory name but only Linux does. I run LANG=C xdg-user-dirs-update after I install Linux with my lang
jbverschoor1 reply#
Windows does (did at least)

And macOS has Xxx.localized directories

fomine33 replies#
Windows just localizes how it shown on Explorer (and have API to get localized name), so real path is still C:\Users\user\Documents . macOS does the same thing by the way as you wrote. I don't think it's a problem.

Only XDG based systems use real /home/user/ドキュメント (in Japanese) directory . This is annoying. Please localize it well as Win/mac does.

Continue this thread — 3 replies

Continue this thread — 2 more replies

superluserdo#
Plug: I made a small set of shell scripts to achieve something similar to this a couple of years ago, but with symlinks:

https://tomwh.uk/blog/posts/2020/03/28/fake-home-prison/
https://tomwh.uk/git/fake-home.git/
It's a simple command that shadows the binary names you want with a wrapper in ~/.local/bin/ that calls the original binary after redefining $HOME to be somewhere else (by default inside ~/.local/share/fake-home/).
So if you have a program foo that dumps stuff in ~/.foo, then running `fakehome-banish foo` will create a symlink "foo" inside ~/.local/bin/evil-software (which is added to $PATH) that points to "fakehome".
"fakehome" is a simple wrapper script that, busybox-style, gets the binary name that it's being called as ("foo"), and then sets $HOME to be ~/.local/share/fakehome and calls the original foo binary.

Load more comments