mirror of
https://github.com/swaywm/sway.git
synced 2025-11-07 13:29:56 -05:00
Introduce a way to show config warnings in swaynag
Adds the function `config_add_swaynag_warning(char *fmt, ...)` so that handlers can add warnings to the swaynag config log in a uniform way. The formatting is identical to errors and include the line number, line, and config path. This also alters the background file access warning to use the function and introduces a warning for duplicate bindings.
This commit is contained in:
parent
a22d0c0ff6
commit
e5f90f25d7
4 changed files with 43 additions and 7 deletions
|
|
@ -255,8 +255,12 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
|
|||
for (int i = 0; i < mode_bindings->length; ++i) {
|
||||
struct sway_binding *config_binding = mode_bindings->items[i];
|
||||
if (binding_key_compare(binding, config_binding)) {
|
||||
wlr_log(WLR_DEBUG, "overwriting old binding with command '%s'",
|
||||
config_binding->command);
|
||||
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);
|
||||
free_sway_binding(config_binding);
|
||||
mode_bindings->items[i] = binding;
|
||||
overwritten = true;
|
||||
|
|
|
|||
|
|
@ -116,11 +116,8 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
|
|||
if (!can_access) {
|
||||
wlr_log(WLR_ERROR, "Unable to access background file '%s': %s",
|
||||
src, strerror(errno));
|
||||
if (config->reading && !config->validating) {
|
||||
swaynag_log(config->swaynag_command,
|
||||
&config->swaynag_config_errors,
|
||||
"Unable to access background file '%s'", src);
|
||||
}
|
||||
config_add_swaynag_warning("Unable to access background file '%s'",
|
||||
src);
|
||||
free(src);
|
||||
} else {
|
||||
// Escape double quotes in the final path for swaybg
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue