From 6ce880fe0ca554e12f23afc76c6352fe28a79271 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sat, 19 Apr 2025 19:37:53 +0300 Subject: [PATCH] foot-git: re-add fullstreen alpha patch --- pkgs/foot-git/package.nix | 11 ++- .../patches/foot_fullscreen_alpha.patch | 80 +++++++++++++++++++ 2 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 pkgs/foot-git/patches/foot_fullscreen_alpha.patch diff --git a/pkgs/foot-git/package.nix b/pkgs/foot-git/package.nix index 4aaf266..f2f23d4 100644 --- a/pkgs/foot-git/package.nix +++ b/pkgs/foot-git/package.nix @@ -1,4 +1,5 @@ { + withAlphaPatch ? true, lib, fetchFromGitea, foot, @@ -6,7 +7,7 @@ date, ... }: -foot.overrideAttrs (let +foot.overrideAttrs (oldAttrs: let pin = pins.foot; in { pname = "foot-transparent"; @@ -20,6 +21,14 @@ in { sha256 = pin.hash; }; + patches = + (oldAttrs.patches or []) + ++ (lib.optionals withAlphaPatch [ + # Thank you fazzi :) + # + ./patches/foot_fullscreen_alpha.patch + ]); + meta = { description = "An auto-upgrading version of FOot to ensure we are always up to dates"; mainProgram = "foot"; diff --git a/pkgs/foot-git/patches/foot_fullscreen_alpha.patch b/pkgs/foot-git/patches/foot_fullscreen_alpha.patch new file mode 100644 index 0000000..f3ab98f --- /dev/null +++ b/pkgs/foot-git/patches/foot_fullscreen_alpha.patch @@ -0,0 +1,80 @@ +From bebc6f0ffd0d767f560ee50825a0b0fba197c90f 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 347cc1ec..fa081ce7 100644 +--- a/config.c ++++ b/config.c +@@ -1095,6 +1095,10 @@ parse_section_main(struct context *ctx) + return true; + } + ++ 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; +@@ -3347,6 +3351,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 2dec82c1..542e22e6 100644 +--- a/config.h ++++ b/config.h +@@ -167,6 +167,8 @@ struct config { + + enum { STARTUP_WINDOWED, STARTUP_MAXIMIZED, STARTUP_FULLSCREEN } startup_mode; + ++ bool transparent_fullscreen; ++ + bool dpi_aware; + enum {GAMMA_CORRECT_DISABLED, + GAMMA_CORRECT_ENABLED, +diff --git a/render.c b/render.c +index 0e403949..2040d5be 100644 +--- a/render.c ++++ b/render.c +@@ -744,7 +744,8 @@ render_cell(struct terminal *term, pixman_image_t *pix, + _bg = swap; + } + +- if (!term->window->is_fullscreen && term->colors.alpha != 0xffff) { ++ 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) { +@@ -1215,7 +1216,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; + } +@@ -3244,7 +3245,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);