Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST] Consider XDG config directory #40

Closed
dglava opened this issue Jul 16, 2017 · 5 comments
Closed

[FEATURE REQUEST] Consider XDG config directory #40

dglava opened this issue Jul 16, 2017 · 5 comments

Comments

@dglava
Copy link

dglava commented Jul 16, 2017

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.

@hrkfdn
Copy link
Owner

hrkfdn commented Jul 18, 2017

Sounds reasonable, I will have a look at it after I'm done with exams

@hrkfdn hrkfdn closed this as completed in 0039b96 Aug 26, 2017
@dglava
Copy link
Author

dglava commented Aug 26, 2017

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 of XDG_CONFIG_HOME/mpdas/mpdasrc

@hrkfdn
Copy link
Owner

hrkfdn commented Aug 26, 2017

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.

@dglava
Copy link
Author

dglava commented Aug 26, 2017

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.

@hrkfdn
Copy link
Owner

hrkfdn commented Aug 26, 2017

No worries, thanks for your feedback! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants