theming: write vesktop quickCss in place, live re-theme without Ctrl+R

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-08-20 09:37:18 +01:00
parent 6cf8e269a0
commit a6b4646f9e

View file

@ -466,7 +466,12 @@ let
# be applied after Midnight to win, and vencord injects quickCss after # be applied after Midnight to win, and vencord injects quickCss after
# themes. Shipping the same CSS as a theme instead puts it in the same # themes. Shipping the same CSS as a theme instead puts it in the same
# cascade slot as Midnight, where load order decides and we lose. # cascade slot as Midnight, where load order decides and we lose.
install -Dm644 "$theme/vesktop.css" "$HOME/.config/vesktop/settings/quickCss.css" # Written IN PLACE (cat >), not install: vencord's fs.watch is inotify on
# the inode, and install unlinks+recreates — new inode, watch left on the
# dead one, so only the first switch per vesktop run ever landed. Keeping
# 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" install -Dm644 "$theme/zen.css" "$HOME/${zenChrome}/userChrome.css"
# Icon theme: replace the directory contents (cheap — the tree is # Icon theme: replace the directory contents (cheap — the tree is
@ -511,21 +516,10 @@ let
fi fi
fi fi
# Vesktop: the file above is always correct, but vencord watches it with # No vesktop reload needed: the in-place quickCss write above keeps
# fs.watch on the FILE and delivers one event per vesktop run here, so # vencord's file watch alive, so the CSS hot-swaps in the running window.
# every switch after the first is ignored. (Not our writes — a standalone # (The old install-based write replaced the inode, killed the watch after
# fs.watch sees all of them.) Reloading the renderer re-runs # one event, and needed a Ctrl+R sendshortcut here — which dropped calls.)
# VencordInitFileWatchers, which re-reads quickCss and rebinds the watch.
#
# Ctrl+R is Electron's reload accelerator, and it is the same thing that
# works by hand. Cost: discord visibly reloads for a second or two on
# every switch. Delete these three lines if that annoys more than the
# stale colours do.
if ${pkgs.hyprland}/bin/hyprctl -j clients 2>/dev/null \
| ${pkgs.jq}/bin/jq -e 'any(.[].class; test("^[Vv]esktop$"))' >/dev/null 2>&1; then
${pkgs.hyprland}/bin/hyprctl dispatch sendshortcut 'CTRL, R, class:^([Vv]esktop)$' \
|| echo "vesktop sendshortcut failed"
fi
# Point GTK3 at this wallpaper's theme. Every wallpaper has its own theme # Point GTK3 at this wallpaper's theme. Every wallpaper has its own theme
# name, so this is always a real change: gsettings emits, the portal # name, so this is always a real change: gsettings emits, the portal