Repository navigation
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.
Follow the Omarchy font on every surface
Summary
disktree takes its colours from the Omarchy theme, but draws its text in
GPUI's fixed system UI face (
.SystemUIFont, which on Linux is the embeddedIBM Plex Sans).
omarchy font setonly writes fontconfig, so nothing the appdid was reachable by the desktop's one font setting. The result is the one
piece of the app that does not look like the rest of Omarchy.
This PR makes the chosen family reach every text surface, and keeps it live:
changing the font while disktree is open now repaints it, like the shell.
Why it takes more than swapping the label font
Three separate layers were involved:
The app's own text. Six call sites used
theme.font; those were easyto route through
Theme::mono_font, which is where gpui-omarchy puts thefamily fontconfig resolves for
monospace.gpui-omarchy's controls. Buttons, segmented control items, checkboxes,
text fields, dialogs and tooltips are drawn by the crate itself, and each
of them styles itself with
Theme::font(33 sites). Changing only the sixapp call sites leaves exactly the controls people touch —
Open,Mark for removal,Size/Files/Age, both checkboxes, the path field — in theold face. So on Omarchy
Theme::fontis set to the desktop family instead,via a
Themeobserver that restores it after every theme reload(
Theme::applyresets it).Live changes. gpui-omarchy resolves
mono_fontonce per process(
OnceLock) and its watcher only watchestheme/colors.tomlandtheme.name.omarchy font setwrites~/.config/fontconfig/fonts.confand restarts the shell; no theme event fires, and a theme event would not
re-resolve the family anyway. So this adds a small watcher on
~/.config/fontconfig(recursive) that ignores access events, coalescesthe burst from the rewrite, waits 50 ms so the truncated file is never read
empty, then re-runs the same
fc-match monospacequery and updates thetheme.
desktop_facere-resolves from fontconfig rather than copying the theme'scached field, so a font change is not undone by a later colour-theme change.
Files
crates/disktree-app/src/appearance.rs—follows_omarchy,font,follow_desktop_face, the fontconfig watcher and the theme observer.crates/disktree-app/src/views.rs,widgets.rs,treemap_view.rs— thesix text call sites go through
appearance::font.crates/disktree-app/src/main.rs—follow_desktop_faceaftergpui_omarchy::init.crates/disktree-app/src/tests.rs— the face survives a theme reload.crates/disktree-app/Cargo.toml—notifyandasync-channel, bothalready in
Cargo.lockthrough gpui-omarchy (no new downloads).README.md— "theme and font".Behaviour elsewhere
Unchanged. The helper and the watcher are Omarchy-only; macOS and Windows keep
GPUI's system UI face and the monospace progress lanes.
Testing
New tests:
appearance::tests::either_omarchy_theme_location_marks_the_desktopappearance::tests::omarchy_draws_with_the_desktop_monospace_facetests::the_desktop_face_survives_a_theme_reload— applies a theme, checksthe face, applies another theme, checks the observer restored it.
Manual, same process, isolated
HOME/FONTCONFIG_FILE: launch with afontconfig mapping
monospaceto FiraCode, rewrite the file toCaskaydiaMono, and the header repaints about 3 s later with the same pid. No
relaunch.
Known limits
~/.config/fontconfigdirectory at launch hasnothing to watch; its very first
omarchy font setstill needs a restart.Every Omarchy install I checked has the directory.
mono_fontfor the process, or re-resolve it from its watcher. I am happy to send that
separately; this PR keeps disktree correct in the meantime.
Screenshots
The same window before and after the change, at 1920×1080. Labels, buttons,
checkboxes, the segmented control, the path field and the tooltips all move
from GPUI's embedded IBM Plex Sans to the family
omarchy font setchose:Hot reload
The same process — it is open, the font is changed from Omarchy's picker, and
the window repaints in place. No relaunch:
The full 36 s recording is
disktree_font_hot_reload.mp4(1920×1080, 60 fps).