Bind logo+q when no config file is specified

This commit is contained in:
emersion 2017-10-02 18:03:28 +02:00
parent 238ded1578
commit 517a709cdd
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48

View file

@ -216,14 +216,6 @@ struct roots_config *parse_args(int argc, char *argv[]) {
wl_list_init(&config->devices); wl_list_init(&config->devices);
wl_list_init(&config->bindings); wl_list_init(&config->bindings);
// TEMPORARY, probably
struct binding_config *bc = calloc(1, sizeof(struct binding_config));
wl_list_insert(&config->bindings, &bc->link);
bc->command = strdup("exit");
bc->keysyms_len = 1;
bc->keysyms = calloc(1, sizeof(xkb_keysym_t));
bc->keysyms[0] = XKB_KEY_Escape;
int c; int c;
while ((c = getopt(argc, argv, "C:h")) != -1) { while ((c = getopt(argc, argv, "C:h")) != -1) {
switch (c) { switch (c) {
@ -253,6 +245,14 @@ struct roots_config *parse_args(int argc, char *argv[]) {
if (result == -1) { if (result == -1) {
wlr_log(L_DEBUG, "No config file found. Using empty config."); wlr_log(L_DEBUG, "No config file found. Using empty config.");
struct binding_config *bc = calloc(1, sizeof(struct binding_config));
wl_list_insert(&config->bindings, &bc->link);
bc->command = strdup("exit");
bc->keysyms_len = 2;
bc->keysyms = calloc(1, sizeof(xkb_keysym_t));
bc->keysyms[0] = XKB_KEY_Meta_L;
bc->keysyms[1] = XKB_KEY_q;
} else if (result == -2) { } else if (result == -2) {
wlr_log(L_ERROR, "Could not allocate memory to parse config file"); wlr_log(L_ERROR, "Could not allocate memory to parse config file");
exit(1); exit(1);