[FEATURE REQUEST] Consider XDG config directory
dglava opened this issue · 5 comments
Hi,
would it be possible for mpdas to use XDG_CONFIG_HOME or fall back to its default if it's not set (/home/user/.config/) ?
It might be just my personal preference, but I like having all the config files in one directory compared to the current way where it's directly in the home directory. A lot of programs consider the XDG_CONFIG_HOME environment variable or just default straight to the ".config" directory in the home directory.
Sounds reasonable, I will have a look at it after I'm done with exams
I just tested it and I was getting an error code 4. I assume it couldn't find my config file.
(15:47:07) [ERROR] You are not root. Not changing user ..
(15:47:07) [INFO] Cannot parse config file (/home/dino/.mpdasrc).
(15:47:07) [INFO] Using Last.fm service URL
(15:47:07) [INFO] Connected to MPD.
(15:47:08) [ERROR] Code: 4
(15:47:08) [ERROR] Authentication failed. Please check your login data.
(15:47:08) [INFO] Closing mpdas.
My config file is located in ~/.config/mpdas/mpdasrc
.
I did a bit of testing and it works if I move the config file to ~/.config/
and make it a file inside that directory, i.e: ~/.config/mpdas
.
This might be nitpicking, but would it be possible to:
- make it look for a config file with the same name as in the other locations (mpdasrc) for consistency's sake
- maybe make it look for the configuration file inside the mpdas directory in
~/.config
or whatever XDG_CONFIG_HOME is set to. Example~/.config/mpdas/mpdasrc
or the equivalent ofXDG_CONFIG_HOME/mpdas/mpdasrc
It opens XDG_CONFIG_HOME/mpdas or ~/.config/mpdas if XDG_CONFIG_HOME is not set. It seems a bit redundant to create a directory for a single file. Does that contradict with the standard?
Changing the filename from mpdas to mpdasrc I can agree with, though.
I'm not really sure about the specification.
https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
A user specific version of the configuration file may be created in $XDG_CONFIG_HOME/subdir/filename, taking into account the default value for $XDG_CONFIG_HOME if $XDG_CONFIG_HOME is not set.
But you're right, it might be overkill for just one file. The other programs, that use subdirectories, have multiple files and it makes sense for them. Changing the name to mpdasrc is enough.
Thanks for implementing this.
No worries, thanks for your feedback! :)