From cd75128c89dc083524667d2fb1d4ca50874ace9b Mon Sep 17 00:00:00 2001 From: Fazzi Date: Fri, 18 Apr 2025 21:15:19 +0100 Subject: [PATCH] config: add transparent_fullscreen option --- config.c | 5 +++++ config.h | 2 ++ render.c | 8 +++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/config.c b/config.c index 07f781d6..8304729a 100644 --- a/config.c +++ b/config.c @@ -1098,6 +1098,10 @@ parse_section_main(struct context *ctx) (int *)&conf->initial_color_theme); } + else if (streq(key, "transparent-fullscreen")) { + return value_to_bool(ctx, &conf->transparent_fullscreen); + } + else { LOG_CONTEXTUAL_ERR("not a valid option: %s", key); return false; @@ -3389,6 +3393,7 @@ config_load(struct config *conf, const char *conf_path, }, .multiplier = 3., }, + .transparent_fullscreen = false, .colors = { .fg = default_foreground, .bg = default_background, diff --git a/config.h b/config.h index 7cf6f6f5..2ab21716 100644 --- a/config.h +++ b/config.h @@ -237,6 +237,8 @@ struct config { enum { STARTUP_WINDOWED, STARTUP_MAXIMIZED, STARTUP_FULLSCREEN } startup_mode; + bool transparent_fullscreen; + bool dpi_aware; bool gamma_correct; struct config_font_list fonts[4]; diff --git a/render.c b/render.c index 83a160bc..ba0f6097 100644 --- a/render.c +++ b/render.c @@ -768,7 +768,8 @@ render_cell(struct terminal *term, pixman_image_t *pix, _bg = swap; } - else if (!term->window->is_fullscreen && term->colors.alpha != 0xffff) { + else if ((!term->window->is_fullscreen || term->conf->transparent_fullscreen) + && term->colors.alpha != 0xffff) { switch (term->conf->colors.alpha_mode) { case ALPHA_MODE_DEFAULT: { if (cell->attrs.bg_src == COLOR_DEFAULT) { @@ -1234,7 +1235,7 @@ render_margin(struct terminal *term, struct buffer *buf, const uint32_t _bg = !term->reverse ? term->colors.bg : term->colors.fg; uint16_t alpha = term->colors.alpha; - if (term->window->is_fullscreen) { + if (term->window->is_fullscreen && !term->conf->transparent_fullscreen) { /* Disable alpha in fullscreen - see render_cell() for details */ alpha = 0xffff; } @@ -3264,7 +3265,8 @@ grid_render(struct terminal *term) xassert(term->height > 0); struct buffer_chain *chain = term->render.chains.grid; - bool use_alpha = !term->window->is_fullscreen && + bool use_alpha = (!term->window->is_fullscreen || + term->conf->transparent_fullscreen) && term->colors.alpha != 0xffff; struct buffer *buf = shm_get_buffer( chain, term->width, term->height, use_alpha);