|
|
@ -16,6 +16,10 @@ struct cmd_results *cmd_bindsym(int argc, char **argv) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct sway_binding *binding = malloc(sizeof(struct sway_binding));
|
|
|
|
struct sway_binding *binding = malloc(sizeof(struct sway_binding));
|
|
|
|
|
|
|
|
if (!binding) {
|
|
|
|
|
|
|
|
return cmd_results_new(CMD_FAILURE, "bindsym",
|
|
|
|
|
|
|
|
"Unable to allocate binding");
|
|
|
|
|
|
|
|
}
|
|
|
|
binding->keys = create_list();
|
|
|
|
binding->keys = create_list();
|
|
|
|
binding->modifiers = 0;
|
|
|
|
binding->modifiers = 0;
|
|
|
|
binding->release = false;
|
|
|
|
binding->release = false;
|
|
|
@ -46,14 +50,21 @@ struct cmd_results *cmd_bindsym(int argc, char **argv) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Check for xkb key
|
|
|
|
// Check for xkb key
|
|
|
|
xkb_keysym_t sym = xkb_keysym_from_name(split->items[i], XKB_KEYSYM_CASE_INSENSITIVE);
|
|
|
|
xkb_keysym_t sym = xkb_keysym_from_name(split->items[i],
|
|
|
|
|
|
|
|
XKB_KEYSYM_CASE_INSENSITIVE);
|
|
|
|
if (!sym) {
|
|
|
|
if (!sym) {
|
|
|
|
error = cmd_results_new(CMD_INVALID, "bindsym", "Unknown key '%s'", (char *)split->items[i]);
|
|
|
|
|
|
|
|
free_sway_binding(binding);
|
|
|
|
free_sway_binding(binding);
|
|
|
|
list_free(split);
|
|
|
|
free_flat_list(split);
|
|
|
|
return error;
|
|
|
|
return cmd_results_new(CMD_INVALID, "bindsym", "Unknown key '%s'",
|
|
|
|
|
|
|
|
(char *)split->items[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
xkb_keysym_t *key = malloc(sizeof(xkb_keysym_t));
|
|
|
|
xkb_keysym_t *key = malloc(sizeof(xkb_keysym_t));
|
|
|
|
|
|
|
|
if (!key) {
|
|
|
|
|
|
|
|
free_sway_binding(binding);
|
|
|
|
|
|
|
|
free_flat_list(split);
|
|
|
|
|
|
|
|
return cmd_results_new(CMD_FAILURE, "bindsym",
|
|
|
|
|
|
|
|
"Unable to allocate binding");
|
|
|
|
|
|
|
|
}
|
|
|
|
*key = sym;
|
|
|
|
*key = sym;
|
|
|
|
list_add(binding->keys, key);
|
|
|
|
list_add(binding->keys, key);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -82,6 +93,10 @@ struct cmd_results *cmd_bindcode(int argc, char **argv) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct sway_binding *binding = malloc(sizeof(struct sway_binding));
|
|
|
|
struct sway_binding *binding = malloc(sizeof(struct sway_binding));
|
|
|
|
|
|
|
|
if (!binding) {
|
|
|
|
|
|
|
|
return cmd_results_new(CMD_FAILURE, "bindsym",
|
|
|
|
|
|
|
|
"Unable to allocate binding");
|
|
|
|
|
|
|
|
}
|
|
|
|
binding->keys = create_list();
|
|
|
|
binding->keys = create_list();
|
|
|
|
binding->modifiers = 0;
|
|
|
|
binding->modifiers = 0;
|
|
|
|
binding->release = false;
|
|
|
|
binding->release = false;
|
|
|
|