From 316601db6cd0e0f5f814ad72d99e21adeaa21d12 Mon Sep 17 00:00:00 2001 From: rope Date: Mon, 31 Aug 2026 19:35:08 +0100 Subject: [PATCH] zen: write userChrome.css again alongside zen-theme.css The watcher not landing left Zen with no theme at all. Keep the startup copy so the floor is the old behaviour, and let the watcher fight for the live update on top. Co-Authored-By: Claude Opus 5 --- apps/zen.nix | 9 +++++---- settings/theming.nix | 13 ++++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/apps/zen.nix b/apps/zen.nix index 6170191..2592a57 100644 --- a/apps/zen.nix +++ b/apps/zen.nix @@ -11,10 +11,11 @@ let # that is what makes a `theme-apply` switch land in a running Zen # (settings/theming.nix writes that file on every switch). # - # userChrome.css can't stay as a safety net: nsIStyleSheetService user - # sheets are ordered BEFORE the profile's userChrome.css, so a leftover copy - # would outrank every sheet we register and pin Zen to whichever wallpaper - # was live at startup — the exact bug this fixes. + # theming.nix still writes userChrome.css too, so a broken watcher costs the + # live update and nothing else. Whether the watcher can win at all is the + # open question: nsIStyleSheetService documents its user sheets as ordered + # BEFORE the profile's userChrome.css, which would let the startup copy + # outrank every sheet we register. # # Everything here goes through Components.classes. The autoconfig sandbox is # not a normal system-principal scope: `Services` is not a global in it, and diff --git a/settings/theming.nix b/settings/theming.nix index ba53d28..65f64dd 100644 --- a/settings/theming.nix +++ b/settings/theming.nix @@ -519,12 +519,15 @@ 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" - # 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. + # Two copies, on purpose. userChrome.css is the one Gecko loads at startup + # and always themes the window. zen-theme.css is the same CSS under a name + # Zen's autoconfig watcher owns: it re-registers that file as a style sheet + # whenever its mtime moves, which is what can land a switch in a running + # window (see apps/zen.nix). If the watcher loses the cascade to + # userChrome.css the result is the old behaviour — themed on next launch — + # never an unthemed browser. + install -Dm644 "$theme/zen.css" "$HOME/${zenChrome}/userChrome.css" 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