More robust theme autoreload#46
Open
ilyaZar wants to merge 1 commit intokitlangton:mainfrom
Open
Conversation
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.
First, I appreciate if you find time to help me out on this, and I fully understand if that takes a bit more time !
The problem: it seems that theme auto-reload does not work consistently, as implemented by my PR #28
For my machine it works, otherwise I wouldnt have filed #28. Yet it does not work here basecamp/omarchy#5589
@kitlangton , if you find time, what would be yr take on the changes I propose here? I find it difficult to assess the nature of (a possible) race conditions if different machines/OS platforms send a
sigusr2signal and how to deal with thatI try to follow the same opentui path used in
opencode’s tuitheme handling, which I roughly understand as:opencode "pre-warms" he terminal palette and waits for theme mode before mounting some theme provider; then rsolves the
systemtheme fromrenderer.getPalette({ size: 16 }); also clears opentui’s palette cache before rresolving system theme colorsThats the files i looked at:
opencode/src/cli/cmd/tui/app.tsxopencode/src/cli/cmd/tui/context/theme.tsxThe idea of the change here keeps ghui’s simpler
SIGUSR2mechanism from #28, but makes that path stricter: clear the cached palette before reads, wait for terminal to settle, retry palette reads, avoid replacing the current system theme when opentui/terminal justreturns incomplete palette datadoes that make sense roughly ?