"""Load the two stylesheets as ordered CSS providers — same scheme as astal-menu's theme.py. _colors.css (generated from ~/Dotfiles/colors.conf by apply-theme.sh) defines the CyberQueer @define-color names; style.css consumes them. Priority is USER+1 for the same reason as astal-menu: the CyberQueer GTK theme at ~/.config/gtk-4.0/gtk.css loads at PRIORITY_USER (800), above APPLICATION (600), and would beat our transparent structural containers otherwise. """ from __future__ import annotations import gi gi.require_version("Gtk", "4.0") from gi.repository import Gdk, Gtk # noqa: E402 from paths import STYLE_DIR def load_css() -> None: display = Gdk.Display.get_default() for name in ("_colors.css", "style.css"): path = STYLE_DIR / name if not path.exists(): continue provider = Gtk.CssProvider() provider.load_from_path(str(path)) Gtk.StyleContext.add_provider_for_display( display, provider, Gtk.STYLE_PROVIDER_PRIORITY_USER + 1 )