aboutsummaryrefslogtreecommitdiffstats
path: root/mpd-notification.c
diff options
context:
space:
mode:
authorGravatar maxice8 <thinkabit.ukim@gmail.com>2019-04-17 11:31:21 -0300
committerGravatar Christian Hesse <mail@eworm.de>2020-11-25 11:34:46 +0100
commitc4464b4406c9fa5adbfbb72ff52b681d8ed044dd (patch)
tree87c7fa3079143f116662c7ed3ae819d86e026885 /mpd-notification.c
parent8157275f6036b1195bcb48b2804320a93bf52992 (diff)
downloadmpd-notification-c4464b4406c9fa5adbfbb72ff52b681d8ed044dd.tar.gz
mpd-notification-c4464b4406c9fa5adbfbb72ff52b681d8ed044dd.tar.zst
try $XDG_CONFIG_HOME/mpd-notification.conf first
Signed-off-by: Christian Hesse <mail@eworm.de>
Diffstat (limited to 'mpd-notification.c')
-rw-r--r--mpd-notification.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/mpd-notification.c b/mpd-notification.c
index 19b2235..5888012 100644
--- a/mpd-notification.c
+++ b/mpd-notification.c
@@ -257,8 +257,12 @@ int main(int argc, char ** argv) {
music_dir = getenv("XDG_MUSIC_DIR");
/* parse config file */
- if (chdir(getenv("HOME")) == 0 && access(".config/mpd-notification.conf", R_OK) == 0 &&
- (ini = iniparser_load(".config/mpd-notification.conf")) != NULL) {
+ if (chdir(getenv("XDG_CONFIG_HOME")) == 0 && access("mpd-notification.conf", R_OK) == 0) {
+ ini = iniparser_load("mpd-notification.conf");
+ } else if (chdir(getenv("HOME")) == 0 && access(".config/mpd-notification.conf", R_OK) == 0) {
+ ini = iniparser_load(".config/mpd-notification.conf");
+ }
+ if (ini != NULL) {
file_workaround = iniparser_getboolean(ini, ":notification-file-workaround", file_workaround);
mpd_host = iniparser_getstring(ini, ":host", mpd_host);
mpd_port = iniparser_getint(ini, ":port", mpd_port);