Skip to content

[Bug]: Ghostty import keeps the last font-family instead of the first #15985

Closed

Description

@hyjeon1985

Operating system

macOS

Orca version

v1.4.188

Details

Short summary:
Settings → Ghostty import collapses a repeated font-family into terminalFontFamily and keeps the last entry. Ghostty treats a repeated font-family as a fallback list with the first entry as primary, so the terminal ends up on a fallback instead of the chosen font.

Reproduction

  1. Write ~/.config/ghostty/config:
font-family = "Menlo"
font-family = "Monaco"
  1. Settings → search "Ghostty" → import.
  • Expected terminal font: Menlo
  • Actual terminal font: Monaco

Both are stock macOS fonts, so a missing font cannot explain it.

Ghostty parses the same file correctly

$ ghostty +show-config | grep '^font-family ='
font-family = Menlo
font-family = Monaco

Ghostty 1.3.1 keeps the list in order; only the import collapses it.

How I ran into it

My real config listed a primary font followed by three fallbacks, mirroring my WezTerm setup:

font-family = "D2CodingLigature Nerd Font"
font-family = "JetBrainsMono Nerd Font"
font-family = "SF Mono"
font-family = "Apple SD Gothic Neo"

The terminal came up in Apple SD Gothic Neo — the last line. I first assumed the primary font was not being resolved, but the two-stock-font case above rules that out and isolates it to the import.

Why it matters

Importing an existing Ghostty config is the intended path into terminal appearance, and fallback lists are common in real configs. The failure is silent: the import reports success and the wrong font simply appears, with no hint that a list was collapsed.

Suggestion

Take the first entry, or map the list into a fallback chain if terminalFontFamily supports one. If only one family can be stored, warning that additional entries were dropped would make the loss visible.

Workaround

Keep a single font-family line in the config used for import.

Activity

  1. maxmilian commented on Aug 23, 2026

    @maxmilian
    Contributor

    Reproduced and traced this. Picking it up — PR shortly.

    The parser is not the problem: parseGhosttyConfig already preserves repeats correctly, collapsing font-family into a string[] (parser.ts, the existing === undefined / Array.isArray(existing) branch).

    It's lost one layer up, in mapper.ts:

    const value = Array.isArray(rawValue) ? (rawValue.at(-1) ?? '') : rawValue

    That flattening is a reasonable default — for most Ghostty keys a later occurrence really does override an earlier one. But font-family is one of the repeatable keys where the first entry is the primary face and the rest are fallbacks, so .at(-1) keeps the least-preferred one. Hence Menlo then Monaco importing as Monaco.

    The fix doesn't need a new mechanism: handlers already receive the unflattened value as their second argument (parser(value, rawValue)), and palette uses exactly that to read all of its entries. font-family can do the same and take the first non-empty entry.

    Scope note: I'm deliberately not turning terminalFontFamily into a fallback stack here — configurable fallback font stacks are already being worked on in #8428, and I don't want to collide with it. This PR only fixes which single face gets imported, so it should merge cleanly either way.

    Will add the red case to the existing mapper.test.ts first.

  2. added theissue type on Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingos:macosIssues affecting macOS

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions