aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorRaimund Sacherer <rsachere@redhat.com>2023-10-07 17:37:04 +0000
committerDaniel Eklöf <daniel@ekloef.se>2023-10-10 06:12:48 +0000
commit827396237253d3c784c7455a9f3f2c26a8128c51 (patch)
tree5684b9466768fb1908153180cc08d2f4c5f28b24 /config.c
parentrender: more fine-grained wayland surface damage tracking (diff)
Enable the use of flash as visual bell
With this patch we can configure flash in the bell section. The colors section allow now to configure the color and translucency of the flash.
Diffstat (limited to 'config.c')
-rw-r--r--config.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/config.c b/config.c
index 4722cfdd..35c847e9 100644
--- a/config.c
+++ b/config.c
@@ -1054,6 +1054,8 @@ parse_section_bell(struct context *ctx)
return value_to_bool(ctx, &conf->bell.urgent);
else if (strcmp(key, "notify") == 0)
return value_to_bool(ctx, &conf->bell.notify);
+ else if (strcmp(key, "visual") == 0)
+ return value_to_bool(ctx, &conf->bell.flash);
else if (strcmp(key, "command") == 0)
return value_to_spawn_template(ctx, &conf->bell.command);
else if (strcmp(key, "command-focused") == 0)
@@ -1237,6 +1239,7 @@ parse_section_colors(struct context *ctx)
return true;
}
+ else if (strcmp(key, "flash") == 0) color = &conf->colors.flash;
else if (strcmp(key, "foreground") == 0) color = &conf->colors.fg;
else if (strcmp(key, "background") == 0) color = &conf->colors.bg;
else if (strcmp(key, "selection-foreground") == 0) color = &conf->colors.selection_fg;
@@ -1320,6 +1323,21 @@ parse_section_colors(struct context *ctx)
return true;
}
+ else if (strcmp(key, "flash-alpha") == 0) {
+ float alpha;
+ if (!value_to_float(ctx, &alpha))
+ return false;
+
+ if (alpha < 0. || alpha > 1.) {
+ LOG_CONTEXTUAL_ERR("not in range 0.0-1.0");
+ return false;
+ }
+
+ conf->colors.flash_alpha = alpha * 65535.;
+ return true;
+ }
+
+
else {
LOG_CONTEXTUAL_ERR("not valid option");
return false;
@@ -2980,6 +2998,7 @@ config_load(struct config *conf, const char *conf_path,
.bell = {
.urgent = false,
.notify = false,
+ .flash = false,
.command = {
.argv = {.args = NULL},
},
@@ -3003,6 +3022,8 @@ config_load(struct config *conf, const char *conf_path,
.colors = {
.fg = default_foreground,
.bg = default_background,
+ .flash = 0x7f7f00,
+ .flash_alpha = 0x7fff,
.alpha = 0xffff,
.selection_fg = 0x80000000, /* Use default bg */
.selection_bg = 0x80000000, /* Use default fg */