Open nagromc opened 2 years ago
This is something we've been wanting to do for a while. Let's use:
$XDG_CONFIG_HOME/wakatime/
$HOME/.wakatime/
$HOME/.wakatime/
Some of the editor extensions already use $HOME/.wakatime/
for the wakatime-cli location.
This seems reasonable to me 👍
Status on this? Would like to declutter my home directory as well 😅
Also if I set the various $XDG_XXXX_HOME
variables on a Mac would WakaTime 'respect' it or always put it in $HOME/.wakatime/
?
And lastly does setting $WAKATIME_HOME
only apply to .wakatime.cfg
or does it also apply to the log and other files that OP mentioned?
Thanks!
On MacOS as well, I think it would be better to default to the XDG_CONFIG_HOME spec and keep the user's HOME tidy. I would imagine there is a go library somewhere that handles most of this already 🤔
go library somewhere that handles most of this already
Each plugin uses a different language so we'll have to implement it in multiple languages, unless we use wakatime-cli for setting the api key instead of writing the file directly from the plugins. The main thing is to make it backwards compatible so the plugins/wakatime-cli detects a config file in $HOME
and moves it to the new location if one doesn't already exist there.
I think the db and log files should go in $XDG_STATE_HOME/wakatime/
(or $XDG_CACHE_HOME/wakatime/
if they can be regenerated), not $XDG_DATA_HOME
(because that’s intended to be for read-only data).
I also agree with @kfdm that the XDG locations should be used on MacOS as well.
Oh, and I think the internal config should probably be in $XDG_CACHE_HOME
, since that looks like it can be regenerated if needed. It’s not really a config file.
I’m not a GoLang programmer, but I just found out there are built-in functions in GoLang to abstract the OS-specific paths of the many directory usecases: config, cache, data, state, etc.
Some documentation:
Maybe you should consider to stick to these conventions after all.
Let's first move ~/.wakatime.log
into ~/.wakatime/wakatime.log
since that's the easiest as it's not read/used by any IDE plugins.
Is your feature request related to a problem? Please describe.
I strive to have a clean home directory, but there are many files related to WakaTime in
~
:.wakatime.bdb
.wakatime.cfg
.wakatime.db
.wakatime.log
.wakatime-internal.cfg
(since #535)Describe the solution you'd like to see
A lot of softwares find their configuration in
$XDG_CONFIG_HOME
(by default at~/.config
), which helps to have a less cluttered~
.WakaTime could use the same convention to place the configuration files such as
.wakatime.cfg
in$XDG_CONFIG_HOME/wakatime
(which would be~/.config/wakatime
by default), and data files such as.wakatime.db
in$XDG_DATA_HOME/wakatime
or$XDG_CACHE_HOME/wakatime
.Describe alternatives you've considered
Another solution would be to group them in a new directory such as
~/.wakatime
.Additional context
This feature request describes the behavior in a Unix environment, but macOS and Windows have their own conventions, even if the XDG Base Directory Specification leaks on them a little. I let you choose what suits the most for those platforms.