Skip to content

app: follow the Omarchy font on every surface - #126

Open
jamerrq wants to merge 1 commit into
tobi:mainfrom
jamerrq:follow-omarchy-font
Open

jamerrq wants to merge 1 commit into
tobi:mainfrom
jamerrq:follow-omarchy-font

Conversation

@jamerrq

@jamerrq jamerrq commented Nov 10, 2026

Copy link
Copy Markdown

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 embedded
IBM Plex Sans). omarchy font set only writes fontconfig, so nothing the app
did 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:

  1. The app's own text. Six call sites used theme.font; those were easy
    to route through Theme::mono_font, which is where gpui-omarchy puts the
    family fontconfig resolves for monospace.

  2. 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 six
    app call sites leaves exactly the controls people touch — Open, Mark for removal, Size/Files/Age, both checkboxes, the path field — in the
    old face. So on Omarchy Theme::font is set to the desktop family instead,
    via a Theme observer that restores it after every theme reload
    (Theme::apply resets it).

  3. Live changes. gpui-omarchy resolves mono_font once per process
    (OnceLock) and its watcher only watches theme/colors.toml and
    theme.name. omarchy font set writes ~/.config/fontconfig/fonts.conf
    and 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, coalesces
    the burst from the rewrite, waits 50 ms so the truncated file is never read
    empty, then re-runs the same fc-match monospace query and updates the
    theme.

desktop_face re-resolves from fontconfig rather than copying the theme's
cached 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 — the
    six text call sites go through appearance::font.
  • crates/disktree-app/src/main.rs — follow_desktop_face after
    gpui_omarchy::init.
  • crates/disktree-app/src/tests.rs — the face survives a theme reload.
  • crates/disktree-app/Cargo.toml — notify and async-channel, both
    already in Cargo.lock through 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

make lint          # rustfmt --check + clippy --all-targets -D warnings
make test          # 93 app + 167 core tests

New tests:

  • appearance::tests::either_omarchy_theme_location_marks_the_desktop
  • appearance::tests::omarchy_draws_with_the_desktop_monospace_face
  • tests::the_desktop_face_survives_a_theme_reload — applies a theme, checks
    the face, applies another theme, checks the observer restored it.

Manual, same process, isolated HOME/FONTCONFIG_FILE: launch with a
fontconfig mapping monospace to FiraCode, rewrite the file to
CaskaydiaMono, and the header repaints about 3 s later with the same pid. No
relaunch.

Known limits

  • A machine that has no ~/.config/fontconfig directory at launch has
    nothing to watch; its very first omarchy font set still needs a restart.
    Every Omarchy install I checked has the directory.
  • The durable fix for live fonts is in gpui-omarchy: stop caching mono_font
    for 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 set chose:

Before — GPUI's system UI face After — the Omarchy mono face
before after

Hot reload

The same process — it is open, the font is changed from Omarchy's picker, and
the window repaints in place. No relaunch:

hot reload

The full 36 s recording is
disktree_font_hot_reload.mp4
(1920×1080, 60 fps).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant