You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Ghostty import keeps the last font-family instead of the first #15985
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
Write ~/.config/ghostty/config:
font-family = "Menlo"
font-family = "Monaco"
Settings → search "Ghostty" → import.
Expected terminal font: Menlo
Actual terminal font: Monaco
Both are stock macOS fonts, so a missing font cannot explain it.
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.
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).
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.
Activity
maxmilian commentedon Aug 23, 2026
Reproduced and traced this. Picking it up — PR shortly.
The parser is not the problem:
parseGhosttyConfigalready preserves repeats correctly, collapsingfont-familyinto astring[](parser.ts, theexisting === undefined / Array.isArray(existing)branch).It's lost one layer up, in
mapper.ts:That flattening is a reasonable default — for most Ghostty keys a later occurrence really does override an earlier one. But
font-familyis 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. HenceMenlothenMonacoimporting asMonaco.The fix doesn't need a new mechanism: handlers already receive the unflattened value as their second argument (
parser(value, rawValue)), andpaletteuses exactly that to read all of its entries.font-familycan do the same and take the first non-empty entry.Scope note: I'm deliberately not turning
terminalFontFamilyinto 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.tsfirst.