mirror of
https://github.com/swaywm/sway.git
synced 2025-11-07 13:29:56 -05:00
Implement bindsym --release
This is a "simple" version of --release (same as i3) that only supports
a binding that contain one normal key. e.g.:
bindsym --release $mod+x exec somthing-fun
I didn't bother implementing it for a combination like `$mod+x+z` since
it is a bit tricky to get right and also a bit weird to actually do on a
keyboard.
This commit is contained in:
parent
8f5de70c93
commit
55f63935ab
5 changed files with 92 additions and 27 deletions
|
|
@ -163,9 +163,25 @@ static struct cmd_results *cmd_bindsym(int argc, char **argv) {
|
|||
return cmd_results_new(CMD_FAILURE, "bindsym", "Can only be used in config file.");
|
||||
}
|
||||
|
||||
|
||||
struct sway_binding *binding = malloc(sizeof(struct sway_binding));
|
||||
binding->keys = create_list();
|
||||
binding->modifiers = 0;
|
||||
binding->release = false;
|
||||
|
||||
// Handle --release
|
||||
if (strcmp("--release", argv[0]) == 0) {
|
||||
if (argc >= 3) {
|
||||
binding->release = true;
|
||||
argv++;
|
||||
argc--;
|
||||
} else {
|
||||
return cmd_results_new(CMD_FAILURE, "bindsym",
|
||||
"Invalid bindsym command"
|
||||
"(expected more than 2 arguments, got %d)", argc);
|
||||
}
|
||||
}
|
||||
|
||||
binding->command = join_args(argv + 1, argc - 1);
|
||||
|
||||
list_t *split = split_string(argv[0], "+");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue