Live-reload the active theme's stylesheets when they change on disk - #2803
Open
0xApotheosis wants to merge 1 commit into
Open
Live-reload the active theme's stylesheets when they change on disk#28030xApotheosis wants to merge 1 commit into
0xApotheosis wants to merge 1 commit into
Conversation
ThemeManager now watches the active theme package's styles directory and recompiles LESS when a stylesheet changes, so edits made outside the app appear in running windows without a restart. This helps theme developers iterate without relaunching, and lets external tools that generate themes (e.g. syncing the OS color palette) apply changes live. Packaged themes inside the app archive are skipped: the archive cannot be watched and never changes at runtime. Events are debounced since theme generators typically rewrite several files in quick succession. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Watches the active theme package's
styles/directory and recompiles LESS when a stylesheet changes on disk, so a running Mailspring restyles without a restart.The driver for this is theme syncing on Omarchy (Arch/Hyprland): a theme-set hook regenerates a Mailspring theme package from the OS palette whenever the system theme changes. OS dark/light flips already apply live, but switching between two dark themes rewrites the LESS under the same package name, and the running app doesn't pick that up until relaunch. This closes that gap. It also gives theme developers live iteration - edit, save, see it.
Notes:
activateThemePackage(), so it follows automatic light/dark resolution..asarpaths are skipped - packaged themes can't change at runtime. In practice only themes in~/.config/Mailspring/packages(and source-tree themes in dev mode) are watched.Verification
ui-variables.lesson disk - the running main window restyled in ~200ms, no restart (Linux, Wayland/Hyprland, real account).sed -itemp-file events were filtered, and multi-file rewrites collapsed into one recompute.forceBaseTheme) behave as before.npm run lintandtsc --noEmitpass.🤖 Generated with Claude Code