From e5f90f25d755b19151dfcfd98790c1bad3eb8068 Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Wed, 28 Nov 2018 11:08:54 -0500 Subject: 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. --- include/sway/config.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/sway/config.h b/include/sway/config.h index 1ff9a104..d02b0d63 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -425,6 +425,8 @@ struct sway_config { list_t *config_chain; const char *current_config_path; const char *current_config; + int current_config_line_number; + char *current_config_line; enum sway_container_border border; enum sway_container_border floating_border; @@ -489,6 +491,11 @@ bool load_include_configs(const char *path, struct sway_config *config, bool read_config(FILE *file, struct sway_config *config, struct swaynag_instance *swaynag); +/** + * Adds a warning entry to the swaynag instance used for errors. + */ +void config_add_swaynag_warning(char *fmt, ...); + /** * Free config struct */ -- cgit v1.2.3-54-g00ecf