Skip to content

TerminalFont (Ghostty): parse config files statically instead of exec'ing ghostty +show-config#2448

Open
clicelee wants to merge 1 commit into
fastfetch-cli:devfrom
clicelee:fix/ghostty-font-static-parse
Open

TerminalFont (Ghostty): parse config files statically instead of exec'ing ghostty +show-config#2448
clicelee wants to merge 1 commit into
fastfetch-cli:devfrom
clicelee:fix/ghostty-font-static-parse

Conversation

@clicelee

@clicelee clicelee commented Jul 12, 2026

Copy link
Copy Markdown

Summary

detectGhostty() currently execs ghostty +show-config, which spawns the full ghostty binary — 42–262ms per run on an M-series Mac (2s+ on a cold first exec), making the terminalfont module by far the slowest one. This PR returns to static config file parsing, but now follows config-file directives, matching ghostty's documented/implemented semantics (verified against loadRecursiveFiles() in ghostty's Config.zig).

Timings (real Ghostty 1.3.1 window, --stat, macOS; the exec cost varies a lot run-to-run):

terminalfont module
before 42–262 ms (2s+ on a cold first exec)
after 0.12–0.40 ms
after, worst case (16 chained config-file includes) 0.8–2 ms

Related issue (required for new logos for new distros)

Closes #2122

Changes

  • config-file includes are queued and parsed after all root files, in discovery order (breadth-first, same as ghostty)
  • Relative include paths resolve against the directory of the including file
  • ? optional prefix supported; missing files are skipped
  • Each unique path loads once (cycle prevention, same as ghostty), plus a 16-file cap as a runaway safety net
  • Root load order fixed to XDG → Application Support so later-loaded AppSupport values win, matching ghostty
  • Removed the +show-config exec path entirely
  • Fixed a latent bug where font-size was parsed and then overwritten with an empty buffer in the static (Muxy) path

Screenshots

The run captured below hit 261.9ms on the exec path; detection output is identical before/after.

Screenshot 2026-07-12 at 12 09 29 AM

Worst case with 16 chained config-file includes — still under 1ms, same detection result (Fira Code (13pt)) from both implementations:

Screenshot 2026-07-12 at 12 22 02 AM

Checklist

  • I have tested my changes locally.

@codacy-production

Copy link
Copy Markdown
Contributor

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

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.

[BUG] ghostty detection is slow (not fast)

1 participant