From 1a1a2d96cb27f70d072765259cddb29a6dd968a0 Mon Sep 17 00:00:00 2001 From: Alex Maese Date: Sun, 2 Dec 2018 15:05:51 -0600 Subject: Add option to bindsym/bindcode to suppress warning on override --- sway/commands/bind.c | 12 +++++++++--- sway/sway.5.scd | 8 +++++--- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'sway') diff --git a/sway/commands/bind.c b/sway/commands/bind.c index 9112815f..c8b634b9 100644 --- a/sway/commands/bind.c +++ b/sway/commands/bind.c @@ -161,6 +161,7 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv, binding->type = bindcode ? BINDING_KEYCODE : BINDING_KEYSYM; bool exclude_titlebar = false; + bool warn = true; // Handle --release and --locked while (argc > 0) { @@ -178,6 +179,8 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv, strlen("--input-device=")) == 0) { free(binding->input); binding->input = strdup(argv[0] + strlen("--input-device=")); + } else if (strcmp("--no-warn", argv[0]) == 0) { + warn = false; } else { break; } @@ -258,9 +261,12 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv, wlr_log(WLR_INFO, "Overwriting binding '%s' for device '%s' " "from `%s` to `%s`", argv[0], binding->input, binding->command, config_binding->command); - config_add_swaynag_warning("Overwriting binding '%s' for device " - "'%s' to `%s` from `%s`", argv[0], binding->input, - binding->command, config_binding->command); + if (warn) { + config_add_swaynag_warning("Overwriting binding" + "'%s' for device '%s' to `%s` from `%s`", + argv[0], binding->input, binding->command, + config_binding->command); + } free_sway_binding(config_binding); mode_bindings->items[i] = binding; overwritten = true; diff --git a/sway/sway.5.scd b/sway/sway.5.scd index 651c2302..f90c9c80 100644 --- a/sway/sway.5.scd +++ b/sway/sway.5.scd @@ -277,14 +277,16 @@ runtime. for\_window move container to output -*bindsym* [--release|--locked] [--input-device=] +*bindsym* [--release|--locked] [--input-device=] [--no-warn] Binds _key combo_ to execute the sway command _command_ when pressed. You may use XKB key names here (*xev*(1) is a good tool for discovering these). With the flag _--release_, the command is executed when the key combo is released. Unless the flag _--locked_ is set, the command will not be run when a screen locking program is active. If _input-device_ is given, the binding will only be executed for that input device and will be executed - instead of any binding that is generic to all devices. + instead of any binding that is generic to all devices. By default, if you + overwrite a binding, swaynag will give you a warning. To silence this, use + the _--no-warn_ flag. Example: ``` @@ -292,7 +294,7 @@ runtime. bindsym Mod1+Shift+f exec firefox ``` - *bindcode* [--release|--locked] [--input-device=] + *bindcode* [--release|--locked] [--input-device=] [--no-warn] is also available for binding with key codes instead of key names. *client.* -- cgit v1.2.3