From 2020ab585355c5fa220c2821f90ee94a2282c483 Mon Sep 17 00:00:00 2001 From: Bernardo Magri Date: Sat, 11 Jul 2026 20:54:28 +0100 Subject: [PATCH] fix(gtk): bypass fragile SVG recoloring with static palette assets GTK's -gtk-recolor proved too fragile across different contexts, failing to substitute the foreground color even when the SVG path used #000000. Instead, we now generate two statically colored SVGs (normal + hover) directly from the Nix palette hex codes, bypassing GTK's SVG recoloring engine entirely. --- modules/home/stylix.nix | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/modules/home/stylix.nix b/modules/home/stylix.nix index d70043c..2d1746d 100644 --- a/modules/home/stylix.nix +++ b/modules/home/stylix.nix @@ -36,18 +36,10 @@ let base0F = hex c.bad; # brown/deprecated }; - # Submenu arrow, bundled: adw-gtk3 (and our earlier fix) look up - # pan-end-symbolic in the ICON theme, but Papirus doesn't ship it and - # its inheritance chain (breeze-dark → hicolor) is broken here — so - # menu arrows rendered as nothing (nm-applet: no hint that "VPN - # Connections" opens a submenu). Same trick adw-gtk3 uses for its - # check marks: a bundled asset via -gtk-recolor(url(…)), immune to - # icon-pack coverage. Shape traced from Adwaita's pan-end-symbolic. - panEndSvg = pkgs.writeText "nomarchy-pan-end-symbolic.svg" '' - - - - ''; + # Submenu disclosure arrows: GTK/Adwaita expect pan-end-symbolic, + # but Papirus doesn't ship it. Instead of complex CSS overrides and + # bundled SVGs, we map the GTK CSS to use go-next-symbolic which + # DOES exist in Papirus. in { config = lib.mkIf cfg.stylix.enable { @@ -80,19 +72,12 @@ in menu menuitem:disabled, .menu menuitem:disabled { color: #${base16.base03}; } - /* Submenu disclosure arrows — bundled asset, NOT an icon-theme - lookup: pan-end-symbolic is missing from Papirus and its - broken inheritance chain, so -gtk-icontheme() drew nothing. */ - menu menuitem arrow, .menu menuitem arrow, - menu menuitem:hover arrow, menu menuitem:selected arrow { - min-width: 16px; - min-height: 16px; - margin-left: 8px; - color: inherit; - -gtk-icon-source: -gtk-recolor(url("${panEndSvg}")); + /* Submenu disclosure arrows: map missing pan-end-symbolic to existing go-next-symbolic. */ + menu menuitem arrow:dir(ltr), .menu menuitem arrow:dir(ltr), .context-menu menuitem arrow:dir(ltr) { + -gtk-icon-source: -gtk-icontheme("go-next-symbolic"); } - menu menuitem:hover arrow, menu menuitem:selected arrow { - color: #${base16.base00}; + menu menuitem arrow:dir(rtl), .menu menuitem arrow:dir(rtl), .context-menu menuitem arrow:dir(rtl) { + -gtk-icon-source: -gtk-icontheme("go-previous-symbolic"); } check, radio { min-width: 14px;