diff --git a/hkd.1 b/hkd.1 index ca0f6a8..44bcc42 100644 --- a/hkd.1 +++ b/hkd.1 @@ -80,6 +80,11 @@ Key names are always capitalized and do not differenciate between upper or lower case, as such hotkeys that require a capitalized letter need to include RIGHTSHIFT or LEFTSHIFT in the keys section. Keys are intended as a list of comma separated strings. +.PP +hkd can live reload the configuration file by signaling it with +.I SIGUSR1 +for example with the command "$ pkill -USR1 -x hkd", for easier use one could add +an hotkey to execute that command. .SH EXAMPLES This is a valid config file example diff --git a/hkd.c b/hkd.c index f0e8051..9ca9db9 100644 --- a/hkd.c +++ b/hkd.c @@ -298,6 +298,7 @@ int main (int argc, char *argv[]) memset(&action, 0, sizeof(action)); action.sa_handler = int_handler; sigaction(SIGINT, &action, NULL); + sigaction(SIGUSR1, &action, NULL); /* Parse config file */ parse_config_file(); @@ -479,6 +480,9 @@ void int_handler (int signum) printf(yellow("Received interrupt signal, exiting gracefully...\n")); dead = 1; break; + case SIGUSR1: + parse_config_file(); + break; } } @@ -725,6 +729,8 @@ void parse_config_file (void) if (!fd) die("Could not open any config files, check the log for more details"); } + + hotkey_list_destroy(hotkey_list); while (exit_state >= 0) { int tmp = 0; memset(block, 0, BLOCK_SIZE + 1);