mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-31 07:11:09 -04:00
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.
This commit is contained in:
parent
c50b1f9900
commit
8273962372
8 changed files with 60 additions and 2 deletions
21
config.c
21
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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue