diff options
-rw-r--r-- | twin/compton-tde/compton.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/twin/compton-tde/compton.c b/twin/compton-tde/compton.c index 4a4d058fd..257b4c2ad 100644 --- a/twin/compton-tde/compton.c +++ b/twin/compton-tde/compton.c @@ -202,6 +202,12 @@ void handle_siguser (int sig) uidnum = getuid(); } if ((sig == SIGUSR1) || (sig == SIGUSR2)) { + /* force redetection of the configuration file location */ + if (ps_g->o.config_file) { + free(ps_g->o.config_file); + ps_g->o.config_file = NULL; + } + get_cfg(ps_g, 0, 0, false); /* reload the configuration file */ /* set background/shadow picture using the new settings */ @@ -5762,6 +5768,9 @@ open_config_file(char *cpath, char **ppath) { char *path = cpath; FILE *f = NULL; + uid_t uid = getuid(); + struct passwd *pw = getpwuid(uid); + if (path) { f = fopen(path, "r"); if (f && ppath) @@ -5800,6 +5809,27 @@ open_config_file(char *cpath, char **ppath) { return f; } + // Then check user configuration files in the system-defined home directory + if (pw != NULL) { + path = mstrjoin(pw->pw_dir, config_filename); + f = fopen(path, "r"); + if (f && ppath) + *ppath = path; + else + free(path); + if (f) + return f; + + path = mstrjoin(pw->pw_dir, config_filename_legacy); + f = fopen(path, "r"); + if (f && ppath) + *ppath = path; + else + free(path); + if (f) + return f; + } + // Check system configuration file in $XDG_CONFIG_DIRS at last if ((dir = getenv("XDG_CONFIG_DIRS")) && strlen(dir)) { char *part = strtok(dir, ":"); |