mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-15 22:05:24 -05:00
config: add alpha_mode option
This commit is contained in:
parent
9a6227acb3
commit
5f83278afd
5 changed files with 38 additions and 0 deletions
|
|
@ -788,6 +788,9 @@
|
|||
|
||||
### Added
|
||||
|
||||
* `alpha-mode` option to `foot.ini`. Defaults to `default`. This
|
||||
config changes how alpha is handled on background colours not set by
|
||||
the terminal.(e.g. vim) ([#1510](1510))
|
||||
* Support for building with _wayland-protocols_ as a subproject.
|
||||
* Mouse wheel scrolls can now be used in `mouse-bindings`
|
||||
([#1077][1077]).
|
||||
|
|
|
|||
10
config.c
10
config.c
|
|
@ -1095,6 +1095,15 @@ parse_section_main(struct context *ctx)
|
|||
return true;
|
||||
}
|
||||
|
||||
else if (strcmp(key, "alpha-mode") == 0) {
|
||||
_Static_assert(sizeof(conf->alpha_mode) == sizeof(int),
|
||||
"enum is not 32-bit");
|
||||
return value_to_enum(
|
||||
ctx,
|
||||
(const char *[]){"default", "matching", "all", NULL},
|
||||
(int *)&conf->alpha_mode);
|
||||
}
|
||||
|
||||
else {
|
||||
LOG_CONTEXTUAL_ERR("not a valid option: %s", key);
|
||||
return false;
|
||||
|
|
@ -3338,6 +3347,7 @@ config_load(struct config *conf, const char *conf_path,
|
|||
},
|
||||
.multiplier = 3.,
|
||||
},
|
||||
.alpha_mode = ALPHA_MODE_DEFAULT,
|
||||
.colors = {
|
||||
.fg = default_foreground,
|
||||
.bg = default_background,
|
||||
|
|
|
|||
2
config.h
2
config.h
|
|
@ -167,6 +167,8 @@ struct config {
|
|||
|
||||
enum { STARTUP_WINDOWED, STARTUP_MAXIMIZED, STARTUP_FULLSCREEN } startup_mode;
|
||||
|
||||
enum { ALPHA_MODE_DEFAULT, ALPHA_MODE_MATCHING, ALPHA_MODE_ALL } alpha_mode;
|
||||
|
||||
bool dpi_aware;
|
||||
enum {GAMMA_CORRECT_DISABLED,
|
||||
GAMMA_CORRECT_ENABLED,
|
||||
|
|
|
|||
2
foot.ini
2
foot.ini
|
|
@ -38,6 +38,8 @@
|
|||
# utmp-helper=/usr/lib/utempter/utempter # When utmp backend is ‘libutempter’ (Linux)
|
||||
# utmp-helper=/usr/libexec/ulog-helper # When utmp backend is ‘ulog’ (FreeBSD)
|
||||
|
||||
# alpha-mode=default # Can be `default`, `matching` or `all`
|
||||
|
||||
[environment]
|
||||
# name=value
|
||||
|
||||
|
|
|
|||
21
render.c
21
render.c
|
|
@ -788,6 +788,27 @@ render_cell(struct terminal *term, pixman_image_t *pix,
|
|||
alpha = term->colors.alpha;
|
||||
}
|
||||
}
|
||||
|
||||
if (!term->window->is_fullscreen) {
|
||||
switch (term->conf->alpha_mode) {
|
||||
case ALPHA_MODE_DEFAULT: {
|
||||
if (cell->attrs.bg_src == COLOR_DEFAULT) {
|
||||
alpha = term->colors.alpha;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ALPHA_MODE_MATCHING: {
|
||||
if (cell->attrs.bg == term->colors.bg) {
|
||||
alpha = term->colors.alpha;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ALPHA_MODE_ALL: {
|
||||
alpha = term->colors.alpha;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (unlikely(is_selected && _fg == _bg)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue