mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Add option to bindsym/bindcode to suppress warning on override
This commit is contained in:
		
							parent
							
								
									bf11a77884
								
							
						
					
					
						commit
						1a1a2d96cb
					
				
					 2 changed files with 14 additions and 6 deletions
				
			
		| 
						 | 
					@ -161,6 +161,7 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
 | 
				
			||||||
	binding->type = bindcode ? BINDING_KEYCODE : BINDING_KEYSYM;
 | 
						binding->type = bindcode ? BINDING_KEYCODE : BINDING_KEYSYM;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool exclude_titlebar = false;
 | 
						bool exclude_titlebar = false;
 | 
				
			||||||
 | 
						bool warn = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Handle --release and --locked
 | 
						// Handle --release and --locked
 | 
				
			||||||
	while (argc > 0) {
 | 
						while (argc > 0) {
 | 
				
			||||||
| 
						 | 
					@ -178,6 +179,8 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
 | 
				
			||||||
					strlen("--input-device=")) == 0) {
 | 
										strlen("--input-device=")) == 0) {
 | 
				
			||||||
			free(binding->input);
 | 
								free(binding->input);
 | 
				
			||||||
			binding->input = strdup(argv[0] + strlen("--input-device="));
 | 
								binding->input = strdup(argv[0] + strlen("--input-device="));
 | 
				
			||||||
 | 
							} else if (strcmp("--no-warn", argv[0]) == 0) {
 | 
				
			||||||
 | 
								warn = false;
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			break;
 | 
								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' "
 | 
								wlr_log(WLR_INFO, "Overwriting binding '%s' for device '%s' "
 | 
				
			||||||
					"from `%s` to `%s`", argv[0], binding->input,
 | 
										"from `%s` to `%s`", argv[0], binding->input,
 | 
				
			||||||
					binding->command, config_binding->command);
 | 
										binding->command, config_binding->command);
 | 
				
			||||||
			config_add_swaynag_warning("Overwriting binding '%s' for device "
 | 
								if (warn) {
 | 
				
			||||||
					"'%s' to `%s` from `%s`", argv[0], binding->input,
 | 
									config_add_swaynag_warning("Overwriting binding"
 | 
				
			||||||
					binding->command, config_binding->command);
 | 
										"'%s' for device '%s' to `%s` from `%s`",
 | 
				
			||||||
 | 
										argv[0], binding->input, binding->command,
 | 
				
			||||||
 | 
										config_binding->command);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			free_sway_binding(config_binding);
 | 
								free_sway_binding(config_binding);
 | 
				
			||||||
			mode_bindings->items[i] = binding;
 | 
								mode_bindings->items[i] = binding;
 | 
				
			||||||
			overwritten = true;
 | 
								overwritten = true;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -277,14 +277,16 @@ runtime.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for\_window <criteria> move container to output <output>
 | 
							for\_window <criteria> move container to output <output>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
*bindsym* [--release|--locked] [--input-device=<device>] <key combo> <command>
 | 
					*bindsym* [--release|--locked] [--input-device=<device>] [--no-warn] <key combo> <command>
 | 
				
			||||||
	Binds _key combo_ to execute the sway command _command_ when pressed. You
 | 
						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).
 | 
						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
 | 
						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
 | 
						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
 | 
						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
 | 
						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:
 | 
						Example:
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
| 
						 | 
					@ -292,7 +294,7 @@ runtime.
 | 
				
			||||||
		bindsym Mod1+Shift+f exec firefox
 | 
							bindsym Mod1+Shift+f exec firefox
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	*bindcode* [--release|--locked] [--input-device=<device>] <code> <command>
 | 
						*bindcode* [--release|--locked] [--input-device=<device>] [--no-warn] <code> <command>
 | 
				
			||||||
	is also available for binding with key codes instead of key names.
 | 
						is also available for binding with key codes instead of key names.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
*client.<class>* <border> <background> <text> <indicator> <child\_border>
 | 
					*client.<class>* <border> <background> <text> <indicator> <child\_border>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue