Repository navigation
feat(settings): let the Ghostty import read a config file you pick - #18659
DeVFirmino wants to merge 1 commit into
Conversation
Auto-discovery only reads Ghostty's own config locations, so a config kept
anywhere else could not be imported without writing it into
~/.config/ghostty/config first. Give the Ghostty import the same optional
source the Warp theme import already has: `{ kind: 'auto' | 'chooseFile' }`,
validated strictly, with a dismissed picker returning a canceled preview.
Auto-discovery stays the default and the no-argument call is unchanged, so
the onboarding theme step keeps working. The picked file goes through the
same read, parse, map and diff pipeline under the existing size ceiling —
the parser, mapper and apply semantics are untouched.
The new button is gated on !isWebClientLocation(): a native dialog cannot be
opened from a paired web client. The pre-existing web-client gap on the
discovered-config button is left alone and tracked separately.
📝 WalkthroughWalkthroughThe PR adds Merge Risk: 🔵 Low · up to This adds a desktop file chooser for Ghostty configuration imports while preserving the existing preview and apply flow. The feature implementation is covered across its layers, but the new manual-import test mock should target the same filesystem module identifier as production code before relying on that coverage. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 7.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 17 files. (2 skipped: 2 unsupported.)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: 3f41b7cc-a8e8-44c1-bc7b-320ba2c8e08d
📒 Files selected for processing (19)
config/localization-coverage-allowlist.jsonsrc/main/ghostty/ghostty-import-source-validation.tssrc/main/ghostty/index.test.tssrc/main/ghostty/index.tssrc/main/ghostty/manual-config-import.test.tssrc/main/ghostty/manual-ghostty-config-file.tssrc/main/ghostty/theme-import.test.tssrc/main/ipc/settings.test.tssrc/main/ipc/settings.tssrc/preload/api/settings-api.tssrc/preload/api/settings-bridge.tssrc/renderer/src/components/settings/TerminalAppearanceSection.ghostty.test.tssrc/renderer/src/components/settings/TerminalAppearanceSection.tsxsrc/renderer/src/components/settings/terminal-advanced-platform-search.tssrc/renderer/src/components/settings/terminal-search.tssrc/renderer/src/components/settings/useGhosttyImport.test.tssrc/renderer/src/components/settings/useGhosttyImport.tssrc/renderer/src/i18n/locales/en.jsonsrc/shared/global-settings-types.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the full diff: an optional { kind: 'auto' | 'chooseFile' } source for the Ghostty import plus the plumbing, dialog, hook, UI, and search/i18n wiring that let users point the import at an arbitrary config file.
previewGhosttyImportsource parameter — gains optional validatedsourceandwebContents; no-argument calls still auto-discover, so the onboarding theme step is untouched.- Main-process modules —
ghostty-import-source-validation.ts(rejectsnull, extra fields, andchooseFolder) andmanual-ghostty-config-file.ts(unfiltered native open dialog, anchored to the requesting window when resolvable). - IPC + preload — handler forwards
argsandevent.sender; bridge signature is(source?: GhosttyImportSource). - Renderer hook + UI —
handleChooseFileClickpreviews before opening the modal (cancel leaves it closed); the button is gated off the paired web client via!isWebClientLocation(). - Search + i18n — new search entries gated behind the desktop-only bucket, en.json strings, and the localization coverage allowlist count bump.
The source is validated before any file is read (extra fields and a smuggled path are rejected), the picked file still goes through the existing size ceiling, and the read/parse/map/diff pipeline is unchanged. Tests assert exact values rather than truthiness, including that only the picked file is read and that a dismissed picker touches nothing.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
Thank you @DeVFirmino for this PR and the careful write-up in #18658! The pick-a-file Ghostty import has landed in #37353. It builds directly on your design: the same |

ELI5
Orca can copy a terminal appearance from a Ghostty config. The import reads only the paths that Ghostty uses. This change adds a second button. The button lets you select any file. The import itself does not change.
What Changed
previewGhosttyImporttakes an optional{ kind: 'auto' | 'chooseFile' }. Warp validates its source the same way. The source is an object with onlykind. Extra fields,null, andchooseFolderare rejected.chooseFileopens the native dialog. The function reads only the picked file. If you dismiss the dialog, or pick nothing, the function returns{ found: false, canceled: true }. The function applies nothing. The preview modal opens only after you pick a file. Cancel leaves the modal closed.src/main/ghostty/discovery.ts) is untouched.config. An extension filter would grey out that file on macOS.!isWebClientLocation()). A native dialog cannot open there.Why
Auto-discovery reads only the config locations that Ghostty uses. You cannot import a config that is in a different location. You must first write that config into
~/.config/ghostty/config. That action overwrites an unrelated file. That file belongs to a different program.The import already works. The gap is that you cannot select a file as the source. The Warp theme import is in the same section. That import already has a file picker. This change removes a difference between two buttons that are next to each other. This change does not add a new concept. Ghostty does not get Warp's
chooseFolder. This import reads a config file. It does not read a theme directory.Linked Issue
Fixes #18658
Visual Proof
Settings -> Appearance -> Terminal Typography, at the same window size and crop.
Before. The heading action is only "Import from Ghostty".
After. "Import from Ghostty" and "Choose Config File" are next to each other.
The images are on a separate branch of my fork, not in this pull request. The template asks that image files are not committed here.
Testing
Ten new main-process tests: no-argument auto-discovery, invalid source, cancel, empty selection, file over the size ceiling, unreadable file, picked file that produces the same diff as auto-discovery, only the picked file is read, dialog anchoring, and a window-less picker. Plus IPC (source forwarded), hook (the modal opens only after a pick. Cancel leaves the modal closed), and UI (button next to the existing one. Hidden on the paired web client).
pnpm lintandpnpm typecheckpass.pnpm testreports 13 failures out of 72,121. All 13 failures are pre-existing and unrelated. The cross-version-wire harness needs git tags. This run used a shallow clone. One flake occurred under load. Every test file in the touched areas passes.pnpm buildwas not run locally. CI should cover it.Tested on macOS. Linux and Windows use the same Electron dialog and the existing read path. Unit tests cover those platforms.
AI Disclosure
I implemented this with Claude (Claude Code). I reviewed the work before I submitted it.
Review
Cross-platform: this change has no new path handling. The picker returns an absolute path. The existing read path is unchanged. The dialog is unfiltered on purpose (extensionless
config). SSH/remote: the dialog and the file read happen on the desktop client. This is the same as the existing import. Mobile: untouched. Mobile keeps its own typography. Paired web: the new button is gated on!isWebClientLocation(). Agents/integrations: no agent or provider surface. Security: no new IPC channel. The source is validated before use (rejects extra fields). The size ceiling still applies. Performance: one extra dialog on an explicit click. The change does no work at startup. UI: the new button is next to the existing one and wraps. Cancel does not flash an empty modal. Backwards compatibility: the no-argument call keeps auto-discovery.Agent skill upstream boundary
Notes
A separate, pre-existing gap exists. The discovered-config button is not gated on the paired web client. The web settings API does not implement
previewGhosttyImport. The button appears there and fails silently. This PR does not change that. This PR stays on one topic. I can open a follow-up.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)