diff options
-rw-r--r-- | example_rc | 6 | ||||
-rw-r--r-- | hotkey.c | 7 |
2 files changed, 8 insertions, 5 deletions
@@ -1,3 +1,3 @@ -control+p dmenu_run & -control+mod1+g xterm -e mocp & -mod1+g xterm & +control+p dmenu_run +control+mod1+g xterm -e mocp +mod1+g xterm @@ -22,8 +22,9 @@ struct Key * parse_key(char *shortcut, char *command) { fprintf(stderr, "could not allocate keys\n"); exit(EXIT_FAILURE); } - key->command = command; - key->mod = 0; + key->command = strndup(command, strlen(command) + 2); + key->command[strlen(command)] = ' '; + key->command[strlen(command) + 1] = '&'; size_t i = 0; @@ -113,6 +114,8 @@ struct Key **load_hotkeys(FILE *fh, size_t *key_len) { res = sscanf(line, "%ms %m[^\n]+", &shortcut, &command); if(res == 2) { key = parse_key(shortcut, command); + if(key == NULL) + error = 1; } else { error = 1; |