zen: hot-reload the theme via autoconfig sheet watcher

Gecko has no userChrome.css reload, so wrap zen with a mozilla.cfg script
that registers chrome/zen-theme.css through nsIStyleSheetService and
re-registers it under a cache-busting URI when its mtime moves.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-08-31 19:15:50 +01:00
parent b823a0c82a
commit 5ad1ac06ca
2 changed files with 68 additions and 6 deletions

View file

@ -7,9 +7,10 @@
# every app that can reload without restarting.
#
# What follows a switch immediately: quickshell, hyprland, ghostty (D-Bus
# reload-config), GTK3 apps such as nemo (each wallpaper installs
# its own named GTK theme, switched over gsettings) and the folder icon tint.
# On next launch only: GTK4/libadwaita apps, btop, zen.
# reload-config), zen (autoconfig sheet watcher, see apps/zen.nix), GTK3 apps
# such as nemo (each wallpaper installs its own named GTK theme, switched over
# gsettings) and the folder icon tint.
# On next launch only: GTK4/libadwaita apps, btop.
#
# stylix stays the source of truth for build-time defaults and for every
# target not listed here — walls/wallpaper.png remains its image.
@ -518,7 +519,12 @@ let
# the inode keeps the watch, and vencord hot-swaps quickCss with no reload.
mkdir -p "$HOME/.config/vesktop/settings"
cat "$theme/vesktop.css" > "$HOME/.config/vesktop/settings/quickCss.css"
install -Dm644 "$theme/zen.css" "$HOME/${zenChrome}/userChrome.css"
# zen-theme.css, not userChrome.css: Zen's autoconfig script watches this
# file's mtime and re-registers it as a style sheet, so a switch lands in
# the running window (see apps/zen.nix). A userChrome.css copy would keep
# loading the wallpaper that was live at startup and fight it.
install -Dm644 "$theme/zen.css" "$HOME/${zenChrome}/zen-theme.css"
rm -f "$HOME/${zenChrome}/userChrome.css"
# Icon theme: replace the directory contents (cheap — the tree is
# symlinks into the papirus store path) so GTK's icon-theme monitor sees