Add support for background blur

This patch adds a new config option: colors{,2}.blur=no|yes. When
enabled, transparent background are also blurred.

Note that this requires the brand new ext-background-effect-v1
protocol, and specifically, that the compositor implements the blur
effect.
This commit is contained in:
Daniel Eklöf 2025-10-16 13:43:33 +02:00
parent aa26676c43
commit e63150305e
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
13 changed files with 154 additions and 43 deletions

42
osc.c
View file

@ -1458,11 +1458,8 @@ osc_dispatch(struct terminal *term)
case 11:
term->colors.bg = color;
if (!have_alpha) {
alpha = term->colors.active_theme == COLOR_THEME_DARK
? term->conf->colors_dark.alpha
: term->conf->colors_light.alpha;
}
if (!have_alpha)
alpha = term_theme_get(term)->alpha;
const bool changed = term->colors.alpha != alpha;
term->colors.alpha = alpha;
@ -1515,10 +1512,7 @@ osc_dispatch(struct terminal *term)
case 104: {
/* Reset Color Number 'c' (whole table if no parameter) */
const struct color_theme *theme =
term->colors.active_theme == COLOR_THEME_DARK
? &term->conf->colors_dark
: &term->conf->colors_light;
const struct color_theme *theme = term_theme_get(term);
if (string[0] == '\0') {
LOG_DBG("resetting all colors");
@ -1558,11 +1552,7 @@ osc_dispatch(struct terminal *term)
case 110: /* Reset default text foreground color */
LOG_DBG("resetting foreground color");
const struct color_theme *theme =
term->colors.active_theme == COLOR_THEME_DARK
? &term->conf->colors_dark
: &term->conf->colors_light;
const struct color_theme *theme = term_theme_get(term);
term->colors.fg = theme->fg;
term_damage_color(term, COLOR_DEFAULT, 0);
break;
@ -1570,11 +1560,7 @@ osc_dispatch(struct terminal *term)
case 111: { /* Reset default text background color */
LOG_DBG("resetting background color");
const struct color_theme *theme =
term->colors.active_theme == COLOR_THEME_DARK
? &term->conf->colors_dark
: &term->conf->colors_light;
const struct color_theme *theme = term_theme_get(term);
bool alpha_changed = term->colors.alpha != theme->alpha;
term->colors.bg = theme->bg;
@ -1593,11 +1579,7 @@ osc_dispatch(struct terminal *term)
case 112: {
LOG_DBG("resetting cursor color");
const struct color_theme *theme =
term->colors.active_theme == COLOR_THEME_DARK
? &term->conf->colors_dark
: &term->conf->colors_light;
const struct color_theme *theme = term_theme_get(term);
term->colors.cursor_fg = theme->cursor.text;
term->colors.cursor_bg = theme->cursor.cursor;
@ -1613,11 +1595,7 @@ osc_dispatch(struct terminal *term)
case 117: {
LOG_DBG("resetting selection background color");
const struct color_theme *theme =
term->colors.active_theme == COLOR_THEME_DARK
? &term->conf->colors_dark
: &term->conf->colors_light;
const struct color_theme *theme = term_theme_get(term);
term->colors.selection_bg = theme->selection_bg;
break;
}
@ -1625,11 +1603,7 @@ osc_dispatch(struct terminal *term)
case 119: {
LOG_DBG("resetting selection foreground color");
const struct color_theme *theme =
term->colors.active_theme == COLOR_THEME_DARK
? &term->conf->colors_dark
: &term->conf->colors_light;
const struct color_theme *theme = term_theme_get(term);
term->colors.selection_fg = theme->selection_fg;
break;
}