mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-29 06:46:35 -04:00
render: whole-window transparency when unfocused
This adds a new option, colors.unfocused-alpha. When set to a value < 1.0, the entire window (*everything* - all bg/fg colors, images etc) are made transparent while the window does not have keyboard focus. The way this is implemented (trying to keep the patch small), we need to do full-screen repaints while in this mode. That is, all screen updates result in full-screen repaints when: * The window does not have keyboard focus * The window *just* gained keyboard focus (i.e. last frame was rendered with transparency) As such, one can expect a fairly large performance impact when there’s large amount of output while the window is unfocused. Focused windows are unaffected, as are unfocused windows when colors.unfocused-alpha == 1.0.
This commit is contained in:
parent
2fbc336eb9
commit
9013a810f1
7 changed files with 57 additions and 0 deletions
13
config.c
13
config.c
|
|
@ -1359,6 +1359,18 @@ parse_section_colors(const char *key, const char *value, struct config *conf,
|
|||
return true;
|
||||
}
|
||||
|
||||
else if (strcmp(key, "unfocused-alpha") == 0) {
|
||||
double alpha;
|
||||
if (!str_to_double(value, &alpha) || alpha < 0. || alpha > 1.) {
|
||||
LOG_AND_NOTIFY_ERR("%s:%d: [colors]: unfocused-alpha: expected a value in the range 0.0-1.0",
|
||||
path, lineno);
|
||||
return false;
|
||||
}
|
||||
|
||||
conf->colors.unfocused_alpha = alpha * 65535.;
|
||||
return true;
|
||||
}
|
||||
|
||||
else {
|
||||
LOG_AND_NOTIFY_ERR("%s:%d: [colors]: %s: invalid key", path, lineno, key);
|
||||
return false;
|
||||
|
|
@ -2940,6 +2952,7 @@ config_load(struct config *conf, const char *conf_path,
|
|||
.fg = default_foreground,
|
||||
.bg = default_background,
|
||||
.alpha = 0xffff,
|
||||
.unfocused_alpha = 0xffff,
|
||||
.selection_fg = 0x80000000, /* Use default bg */
|
||||
.selection_bg = 0x80000000, /* Use default fg */
|
||||
.use_custom = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue