diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-01-15 11:01:02 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-01-15 11:01:02 +0100 |
commit | 11d7a68de63112305d833e802db0b4654c846b77 (patch) | |
tree | acbfba53acc4b802b1e49ab2c3902d1417660377 /src/keyevents.c | |
parent | 9c1f7c9b7fc346c1b09338788e06ba70128820ca (diff) |
Check XDG_CONFIG_HOME for feh/keys as well
Diffstat (limited to 'src/keyevents.c')
-rw-r--r-- | src/keyevents.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/keyevents.c b/src/keyevents.c index 91fa8a4..8e7251d 100644 --- a/src/keyevents.c +++ b/src/keyevents.c @@ -84,7 +84,9 @@ static void feh_set_parse_kb_partial(fehkey *key, int index, char *ks) { } void init_keyevents(void) { - char *home, *confpath; + char *home = NULL; + char *confhome = NULL; + char *confpath = NULL; char line[128]; char action[32], k1[32], k2[32], k3[32]; struct __fehkey *cur_kb = NULL; @@ -149,9 +151,17 @@ void init_keyevents(void) { if (!home) eprintf("No HOME in environment\n"); - confpath = estrjoin("/", home, ".config/feh/keys", NULL); + confhome = getenv("XDG_CONFIG_HOME"); + + if (confhome) + confpath = estrjoin("/", confhome, "feh/keys", NULL); + else + confpath = estrjoin("/", home, ".config/feh/keys", NULL); + conf = fopen(confpath, "r"); + free(confpath); + if (!conf) return; @@ -279,7 +289,6 @@ void init_keyevents(void) { } } fclose(conf); - free(confpath); } static short feh_is_kp(fehkey *key, int sym, int state) { |