From 11d7a68de63112305d833e802db0b4654c846b77 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 15 Jan 2011 11:01:02 +0100 Subject: Check XDG_CONFIG_HOME for feh/keys as well --- src/keyevents.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src') 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) { -- cgit v1.2.3