theming: re-theme every app on wallpaper switch, crossfade wallpaper

settings/theming.nix renders a full config set per wallpaper (GTK, ghostty,
btop, hyprland, vesktop, zen, folder icons) from its own base16 palette;
theme-apply swaps them in and reloads what can reload.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-08-19 14:31:24 +01:00
parent 42adab61df
commit 1091495674
6 changed files with 560 additions and 227 deletions

View file

@ -71,55 +71,23 @@
programs.xwayland.enable = true;
programs.dconf.enable = true;
home-manager.users.fred = { config, lib, pkgs, ... }: let
# Scaling all three channels by the same factor is exactly what
# Qt.lighter() does — hue and HSV saturation stay put, only value moves —
# so this lands on the same surfaces as quickshell's Theme.base01/base02.
# GTK's own shade() can't stand in: it multiplies saturation too.
tint = f: let
ch = k: toString (builtins.floor (builtins.fromJSON config.lib.stylix.colors."base00-rgb-${k}" * f));
in "rgb(${ch "r"}, ${ch "g"}, ${ch "b"})";
in {
home-manager.users.fred = {
# Stylix's qt target only supports qtct; disable it to silence the warning.
stylix.targets.qt.enable = false;
# Minimal titlebars — stylix manages the GTK theme; we layer our
# headerbar shrink on top via stylix.targets.gtk.extraCss.
# Minimal titlebars. The GTK stylesheet itself — stylix's colours plus
# our headerbar shrink and surface-tint overrides — is rendered per
# wallpaper and swapped at runtime in settings/theming.nix.
gtk.enable = true;
dconf.settings."org/nemo/window-state".start-with-menu-bar = false;
# GTK3 ignores dconf's color-scheme=prefer-dark — it only picks
# adw-gtk3's gtk-dark.css when this setting is on. Without it GTK3 apps
# (nemo) load the *light* sheet; stylix's @define-color overrides repaint
# (nemo) load the *light* sheet; the @define-color overrides repaint
# most of it, but colours sass baked in as literals survive — e.g.
# `messagedialog.csd.background button { color: rgba(0,0,6,0.8); }`, which
# is why nemo's delete confirmation had near-black buttons on dark bg.
gtk.gtk3.extraConfig.gtk-application-prefer-dark-theme = true;
stylix.targets.gtk.extraCss = ''
/* Surfaces: one hue, three steps the same ladder quickshell's Theme
uses (settings/quickshell.nix, commit e2c413d). Stylix paints every
raised surface with base01/base02, which come straight off the
wallpaper and routinely land off-hue: base01 is #3f3fab purple over a
slate #1c1f26 desktop, which is why nemo's delete dialog was blue. */
@define-color headerbar_bg_color ${tint 1.7};
@define-color sidebar_bg_color ${tint 1.7};
@define-color card_bg_color ${tint 1.7};
@define-color dialog_bg_color ${tint 1.7};
@define-color popover_bg_color ${tint 1.7};
@define-color scrollbar_outline_color ${tint 2.4};
headerbar { min-height: 0; padding: 0; margin: 0; }
headerbar .title { font-size: 0; }
window:backdrop {
background-color: @window_bg_color;
color: @window_fg_color;
}
window:backdrop headerbar {
background-color: @headerbar_bg_color;
color: @headerbar_fg_color;
}
'';
};
};
}