From 2bef8cf9ce7941cb23e3a9295876f7e852285de6 Mon Sep 17 00:00:00 2001 From: Raimund Sacherer Date: Sat, 7 Oct 2023 19:37:04 +0200 Subject: [PATCH] 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 of the flash and the alpha to apply to. Default values are the values which where currently used for flash, altough I personally like a nice red (eb1313) better. --- doc/foot.ini.5.scd | 12 ++++++++++++ terminal.c | 4 ++++ terminal.h | 2 ++ 3 files changed, 18 insertions(+) diff --git a/doc/foot.ini.5.scd b/doc/foot.ini.5.scd index e276d186..f47b09f9 100644 --- a/doc/foot.ini.5.scd +++ b/doc/foot.ini.5.scd @@ -614,6 +614,18 @@ can configure the background transparency with the _alpha_ option. https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit for an explanation of the remainder. +*flash* + Color to use for the terminal window flash. + + Default: _7f7fff_. + + +*flash_alpha* + Flash translucency. A value in the range 0.0-1.0, where 0.0 + means completely transparent, and 1.0 is opaque. + + Default: _0.7_. + *alpha* Background translucency. A value in the range 0.0-1.0, where 0.0 means completely transparent, and 1.0 is opaque. Default: _1.0_. diff --git a/terminal.c b/terminal.c index efbbded1..c7836d91 100644 --- a/terminal.c +++ b/terminal.c @@ -1172,6 +1172,8 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper, .colors = { .fg = conf->colors.fg, .bg = conf->colors.bg, + .flash = conf->colors.flash, + .flash_alpha = conf->colors.flash_alpha, .alpha = conf->colors.alpha, .selection_fg = conf->colors.selection_fg, .selection_bg = conf->colors.selection_bg, @@ -1924,7 +1926,9 @@ term_reset(struct terminal *term, bool hard) fdm_del(term->fdm, term->blink.fd); term->blink.fd = -1; term->colors.fg = term->conf->colors.fg; term->colors.bg = term->conf->colors.bg; + term->colors.flash = term->conf->colors.flash; term->colors.alpha = term->conf->colors.alpha; + term->colors.flash_alpha = term->conf->colors.flash_alpha; term->colors.selection_fg = term->conf->colors.selection_fg; term->colors.selection_bg = term->conf->colors.selection_bg; term->colors.use_custom_selection = term->conf->colors.use_custom.selection; diff --git a/terminal.h b/terminal.h index a8b65198..97f2c475 100644 --- a/terminal.h +++ b/terminal.h @@ -509,6 +509,8 @@ struct terminal { struct { uint32_t fg; uint32_t bg; + uint32_t flash; + uint32_t flash_alpha; uint32_t table[256]; uint16_t alpha; uint32_t selection_fg;