fix(gtk): bypass fragile SVG recoloring with static palette assets
Some checks failed
Check / eval (push) Failing after 1m55s

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.
This commit is contained in:
2026-07-11 20:54:28 +01:00
parent ebfd344390
commit 2020ab5853

View File

@@ -36,18 +36,10 @@ let
base0F = hex c.bad; # brown/deprecated base0F = hex c.bad; # brown/deprecated
}; };
# Submenu arrow, bundled: adw-gtk3 (and our earlier fix) look up # Submenu disclosure arrows: GTK/Adwaita expect pan-end-symbolic,
# pan-end-symbolic in the ICON theme, but Papirus doesn't ship it and # but Papirus doesn't ship it. Instead of complex CSS overrides and
# its inheritance chain (breeze-dark → hicolor) is broken here — so # bundled SVGs, we map the GTK CSS to use go-next-symbolic which
# menu arrows rendered as nothing (nm-applet: no hint that "VPN # DOES exist in Papirus.
# 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" ''
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="#000000" d="M 6 4 L 10 8 L 6 12 Z"/>
</svg>
'';
in in
{ {
config = lib.mkIf cfg.stylix.enable { config = lib.mkIf cfg.stylix.enable {
@@ -80,19 +72,12 @@ in
menu menuitem:disabled, .menu menuitem:disabled { menu menuitem:disabled, .menu menuitem:disabled {
color: #${base16.base03}; color: #${base16.base03};
} }
/* Submenu disclosure arrows bundled asset, NOT an icon-theme /* Submenu disclosure arrows: map missing pan-end-symbolic to existing go-next-symbolic. */
lookup: pan-end-symbolic is missing from Papirus and its menu menuitem arrow:dir(ltr), .menu menuitem arrow:dir(ltr), .context-menu menuitem arrow:dir(ltr) {
broken inheritance chain, so -gtk-icontheme() drew nothing. */ -gtk-icon-source: -gtk-icontheme("go-next-symbolic");
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}"));
} }
menu menuitem:hover arrow, menu menuitem:selected arrow { menu menuitem arrow:dir(rtl), .menu menuitem arrow:dir(rtl), .context-menu menuitem arrow:dir(rtl) {
color: #${base16.base00}; -gtk-icon-source: -gtk-icontheme("go-previous-symbolic");
} }
check, radio { check, radio {
min-width: 14px; min-width: 14px;