Overview
The Ghostty Config editor uses Svelte 5 runes for reactive state management across three main stores.config.svelte.ts
Location:src/lib/stores/config.svelte.ts
Manages the entire Ghostty configuration state.
Exports
config (default export)
config (default export)
diff()
diff()
Computes configuration changes from defaults.Returns: Object with only modified settings in Ghostty config format.
Behavior
- Converts camelCase keys to kebab-case:
fontSize→font-size - For arrays like
keybind: only includes additions - For
palette: outputspalette = N=colorformat for changes - Skips unchanged values
Example
load()
load()
setColorScheme()
setColorScheme()
resetColorScheme()
resetColorScheme()
Resets all color-related settings to defaults.Resets:
backgroundforegroundcursorColorselectionBackgroundselectionForegroundpalette(all 256 colors)
Implementation
keyToConfig()
keyToConfig()
history.svelte.ts
Location:src/lib/stores/history.svelte.ts
Manages navigation history for the settings pages.
State
Exports
canGoBack()
canGoBack()
Checks if backward navigation is possible.Returns
true if index > 0.canGoForward()
canGoForward()
Checks if forward navigation is possible.Returns
true if there are items ahead in the stack.processNavigation()
processNavigation()
state.svelte.ts
Location:src/lib/stores/state.svelte.ts
Global application state.
State
Usage
Store Patterns
Svelte 5 Runes
All stores use modern Svelte 5 runes instead of writable stores:Direct Mutation
No need for.set() or .update() methods: