Files
archived-orca/src/preload/api/settings-bridge.ts
T
Neil 2541edc98e feat(settings): import Kitty configs through a shared terminal config import pipeline (#37375)
* feat(settings): import Kitty configs through a shared terminal config import pipeline

* fix(settings): harden Kitty include and value parsing

* fix(settings): match Kitty globs linearly, skip read-only system configs, report non-family font selectors

* refactor(settings): read current settings through a typed map when diffing imports

* style: format Ghostty importer

* fix(settings): type the import hook stub and let dialog primitives own their typography
2026-11-02 01:11:26 -08:00

45 lines
1.8 KiB
TypeScript

import { ipcRenderer } from 'electron'
import type {
TerminalConfigImportPreview,
TerminalConfigImportSource
} from '../../shared/terminal-config-import-preview'
import type {
WarpThemeImportPreview,
WarpThemeImportSource
} from '../../shared/terminal-custom-themes'
import type { PreloadApi } from '../api-types'
export const settingsApi = {
get: () => ipcRenderer.invoke('settings:get'),
getSync: () => ipcRenderer.sendSync('settings:get-sync'),
set: (args: Record<string, unknown>) => ipcRenderer.invoke('settings:set', args),
setActiveRuntimeEnvironmentPreference: (args: { environmentId: string | null }) =>
ipcRenderer.invoke('settings:set-active-runtime-environment-preference', args),
updatePRBotAuthorOverride: (args: { author: string; isBot: boolean }) =>
ipcRenderer.invoke('settings:update-pr-bot-author-override', args),
listFonts: (): Promise<string[]> => ipcRenderer.invoke('settings:listFonts'),
previewGhosttyImport: (
source?: TerminalConfigImportSource
): Promise<TerminalConfigImportPreview> =>
ipcRenderer.invoke('settings:previewGhosttyImport', source),
previewKittyImport: (source?: TerminalConfigImportSource): Promise<TerminalConfigImportPreview> =>
ipcRenderer.invoke('settings:previewKittyImport', source),
previewWarpThemeImport: (source: WarpThemeImportSource): Promise<WarpThemeImportPreview> =>
ipcRenderer.invoke('settings:previewWarpThemeImport', source),
onChanged: (callback: (updates: Record<string, unknown>) => void): (() => void) => {
const listener = (_event: Electron.IpcRendererEvent, updates: Record<string, unknown>): void =>
callback(updates)
ipcRenderer.on('settings:changed', listener)
return () => ipcRenderer.removeListener('settings:changed', listener)
}
} satisfies PreloadApi['settings']