aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/bind.c
diff options
context:
space:
mode:
authorLibravatar Alex Maese <memaese@hotmail.com>2018-12-02 15:05:51 -0600
committerLibravatar Alex Maese <memaese@hotmail.com>2018-12-02 21:35:44 -0600
commit1a1a2d96cb27f70d072765259cddb29a6dd968a0 (patch)
tree277085cbe90c8293b07d40b5f185047aed841213 /sway/commands/bind.c
parentfix typo (diff)
downloadsway-1a1a2d96cb27f70d072765259cddb29a6dd968a0.tar.gz
sway-1a1a2d96cb27f70d072765259cddb29a6dd968a0.tar.zst
sway-1a1a2d96cb27f70d072765259cddb29a6dd968a0.zip
Add option to bindsym/bindcode to suppress warning on override
Diffstat (limited to 'sway/commands/bind.c')
-rw-r--r--sway/commands/bind.c12
1 files changed, 9 insertions, 3 deletions
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,
161 binding->type = bindcode ? BINDING_KEYCODE : BINDING_KEYSYM; 161 binding->type = bindcode ? BINDING_KEYCODE : BINDING_KEYSYM;
162 162
163 bool exclude_titlebar = false; 163 bool exclude_titlebar = false;
164 bool warn = true;
164 165
165 // Handle --release and --locked 166 // Handle --release and --locked
166 while (argc > 0) { 167 while (argc > 0) {
@@ -178,6 +179,8 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
178 strlen("--input-device=")) == 0) { 179 strlen("--input-device=")) == 0) {
179 free(binding->input); 180 free(binding->input);
180 binding->input = strdup(argv[0] + strlen("--input-device=")); 181 binding->input = strdup(argv[0] + strlen("--input-device="));
182 } else if (strcmp("--no-warn", argv[0]) == 0) {
183 warn = false;
181 } else { 184 } else {
182 break; 185 break;
183 } 186 }
@@ -258,9 +261,12 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
258 wlr_log(WLR_INFO, "Overwriting binding '%s' for device '%s' " 261 wlr_log(WLR_INFO, "Overwriting binding '%s' for device '%s' "
259 "from `%s` to `%s`", argv[0], binding->input, 262 "from `%s` to `%s`", argv[0], binding->input,
260 binding->command, config_binding->command); 263 binding->command, config_binding->command);
261 config_add_swaynag_warning("Overwriting binding '%s' for device " 264 if (warn) {
262 "'%s' to `%s` from `%s`", argv[0], binding->input, 265 config_add_swaynag_warning("Overwriting binding"
263 binding->command, config_binding->command); 266 "'%s' for device '%s' to `%s` from `%s`",
267 argv[0], binding->input, binding->command,
268 config_binding->command);
269 }
264 free_sway_binding(config_binding); 270 free_sway_binding(config_binding);
265 mode_bindings->items[i] = binding; 271 mode_bindings->items[i] = binding;
266 overwritten = true; 272 overwritten = true;