dstask icon indicating copy to clipboard operation
dstask copied to clipboard

Use $XDG_CONFIG_HOME for config dir

Open joereynolds opened this issue 4 years ago • 12 comments

Currently the dstask config file lives in ~/.dstask. It'd be great to follow the XDG Base Directory Specification and move this into ~/.config/dstask/config. This way, it doesn't clog up our home directory.

The spec is here: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

Thanks!

joereynolds avatar Sep 23 '20 09:09 joereynolds

ignore this, I didn't realise that much more than configuration lives in ~/.dstask. Still it might be worth a read anyway :+1:

joereynolds avatar Sep 23 '20 09:09 joereynolds

Actually, we don't have a lot of runtime config right now. The ~/.dstask is the default location of the task database, which, in the XDG desktop spec, would probably be more like the "data" directory.

Since we don't have much config required, all we need is just environment variables. This may change, though. I'm a fan of the XDG spec, myself.

dontlaugh avatar Sep 23 '20 14:09 dontlaugh

Please reopen this - you probably have to split the files up across the XDG dirs, but that's the point. I want a clean HOME :)

xeruf avatar Sep 25 '20 08:09 xeruf

So where would a data directory go in the XDG spec? I can't seem to find out (but haven't looked hard). Happy to have the dstask configuration file in .config/dstask/dstask.yml when dstask has things to configure. So far it's been unnecessary but a few users have requested things that would require config such as theming.

naggie avatar Oct 05 '20 22:10 naggie

Arch Wiki has a succinct description for linux systems: https://wiki.archlinux.org/index.php/XDG_Base_Directory

When it comes to MacOS, there are a few philosophies

  1. use the same directories as linux regular users, if you're writing a cli app for a regular user
  2. Use the ~/Library paths for data dir and cache dir, but still use ~/.config for config, because c'mon

Normally I'm never messing with the data dir or the cache dir of apps directly, but dstask is special, since manual git commands are sometimes required.

One Windows, there are probably opinions that we shouldn't mess with, but I don't know what those are.

dontlaugh avatar Oct 06 '20 00:10 dontlaugh

Arch Wiki has a succinct description for linux systems: https://wiki.archlinux.org/index.php/XDG_Base_Directory

The arch wiki always has the answer! ~/.local/share/ in this case.

put is in the same place as linux regular users, if you're writing a cli app for a regular user

Good for consistency

but dstask is special, since manual git commands are sometimes required.

I think you're right. I'll leave it as is, at least for now.

naggie avatar Oct 06 '20 07:10 naggie

but dstask is special, since manual git commands are sometimes required.

I think you're right. I'll leave it as is, at least for now.

How is this special? These statements and conclusions don't make sense to me ^^

xeruf avatar Oct 06 '20 11:10 xeruf

@xerus2000 I should clarify. What I meant here was we should not use the ~/Library path if we adopt xdg. My reasoning here is that for MacOS apps that use these paths, the structure there is usually pretty weird looking. See the SO link pasted above.

To wit, I would advocate number 1 in my previous comment.

And to anyone else coming across this issue, you can change the git repo location right now with export DSTASK_GIT_REPO= in your bashrc.

dontlaugh avatar Oct 06 '20 15:10 dontlaugh

this lib seems pretty nice. https://github.com/adrg/xdg . had a cursory look through the code, seems to implement things correctly, has tests and supports darwin and windows as well (see their readme and check if those paths look sensible for windows/mac). does a bit more than what we need but is lightweight anyway.

Dieterbe avatar Nov 28 '20 16:11 Dieterbe

https://github.com/adrg/xdg#xdg-base-directory > the dirs listed here for unix seems fine. Do we have any windows/mac users amongst us who can "sign off" on these paths? Note this lib uses ~/Library/Preferences which seems a bit contentious. But I'ld like to just pick a library and go forward with it. @dontlaugh do you use mac?

Dieterbe avatar Dec 06 '20 21:12 Dieterbe

https://github.com/adrg/xdg#xdg-base-directory > the dirs listed here for unix seems fine. Do we have any windows/mac users amongst us who can "sign off" on these paths? Note this lib uses ~/Library/Preferences which seems a bit contentious. But I'ld like to just pick a library and go forward with it. --

@Dieterbe Not anymore :). The library now suggests writing files relative to the ~/Library/Application Support directory, if XDG_CONFIG_HOME is not set. However, it can find config files relative to ~/Library/Preferences, /Library/Application Support and /Library/Preferences as well.

adrg avatar Feb 22 '21 17:02 adrg

whoever has time for it, let's go forward with this library. thanks for your input @adrg :)

Dieterbe avatar Feb 25 '21 15:02 Dieterbe