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.
This commit is contained in:
Raimund Sacherer 2023-10-07 19:37:04 +02:00
parent 36ed07788e
commit 9147407f9f
6 changed files with 16 additions and 13 deletions

View file

@ -60,9 +60,12 @@
row ([#1364][1364]).
* Support for DECSET/DECRST/DECRQM 2027 (_Grapheme cluster
processing_).
* Support for visual bell which flashes the terminal window.
([#1508][1508]).
[1077]: https://codeberg.org/dnkl/foot/issues/1077
[1364]: https://codeberg.org/dnkl/foot/issues/1364
[1508]: https://codeberg.org/dnkl/foot/issues/1508
### Changed

View file

@ -1031,7 +1031,7 @@ 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, "flash") == 0)
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);
@ -1300,7 +1300,7 @@ parse_section_colors(struct context *ctx)
return true;
}
else if (strcmp(key, "flash_alpha") == 0) {
else if (strcmp(key, "flash-alpha") == 0) {
float alpha;
if (!value_to_float(ctx, &alpha))
return false;

View file

@ -394,9 +394,8 @@ Note: do not set *TERM* here; use the *term* option in the main
Default: _no_
*flash*
When set to _yes_, foot will emit the bell signal flashing the
terminal window whenever *BEL* is received.
*visual*
When set to _yes_, foot will flash terminal window.
Default: _no_
@ -618,14 +617,13 @@ can configure the background transparency with the _alpha_ option.
*flash*
Color to use for the terminal window flash.
Default: _7f7fff_.
Default: _7f7f00_.
*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_.
Default: _0.5_.
*alpha*
Background translucency. A value in the range 0.0-1.0, where 0.0

View file

@ -43,7 +43,7 @@
[bell]
# urgent=no
# notify=no
# flash=no
# visual=no
# command=
# command-focused=no
@ -78,8 +78,8 @@
# alpha=1.0
# background=242424
# foreground=ffffff
# flash=7f7fff
# flash_alpha=0.7
# flash=7f7f00
# flash_alpha=0.5
## Normal/regular colors (color palette 0-7)
# regular0=242424 # black

View file

@ -1582,7 +1582,9 @@ render_overlay(struct terminal *term)
break;
case OVERLAY_FLASH:
color = color_hex_to_pixman_with_alpha(term->colors.flash, term->colors.flash_alpha);
color = color_hex_to_pixman_with_alpha(
term->conf->colors.flash,
term->conf->colors.flash_alpha);
break;
}

View file

@ -3294,7 +3294,7 @@ term_bell(struct terminal *term)
notify_notify(term, "Bell", "Bell in terminal");
if (term->conf->bell.flash)
term_flash(term, 100);
term_flash(term, 100);
if ((term->conf->bell.command.argv.args != NULL) &&
(!term->kbd_focus || term->conf->bell.command_focused))