From 28ef350f3909018608c9c7c654f7a7eec6c2e373 Mon Sep 17 00:00:00 2001 From: Amit Haridas Date: Thu, 23 Jul 2026 00:22:21 +0530 Subject: [PATCH] feat(ipc): expose monospace settings through preload bridge - Add 'get-monospace-settings' + 'set-monospace-settings' to allowlist - Expose electronAPI.monospace.{getSettings,saveSettings} - Extend ElectronAPI TypeScript interface with the monospace namespace --- src/preload.js | 9 +++++++++ src/renderer/types/electron.d.ts | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/preload.js b/src/preload.js index d3afcdb..9606ec1 100644 --- a/src/preload.js +++ b/src/preload.js @@ -149,6 +149,10 @@ const ALLOWED_SEND_CHANNELS = [ 'crash:open-dir', 'crash:delete', + // Monospace font settings + 'get-monospace-settings', + 'set-monospace-settings', + // Git diff 'git-diff', @@ -496,6 +500,11 @@ contextBridge.exposeInMainWorld('electronAPI', { openDir: () => ipcRenderer.send('crash:open-dir'), delete: (filename) => ipcRenderer.invoke('crash:delete', filename), }, + + monospace: { + getSettings: () => ipcRenderer.invoke('get-monospace-settings'), + saveSettings: (partial) => ipcRenderer.invoke('set-monospace-settings', partial), + }, }); // Log successful preload initialization diff --git a/src/renderer/types/electron.d.ts b/src/renderer/types/electron.d.ts index 5b5bccc..cdeacf0 100644 --- a/src/renderer/types/electron.d.ts +++ b/src/renderer/types/electron.d.ts @@ -128,6 +128,20 @@ export interface ElectronAPI { openDir: () => void; delete: (filename: string) => Promise; }; + + monospace: { + getSettings: () => Promise<{ + monospaceFont: 'jetbrains-mono' | 'fira-code'; + monospaceLigatures: boolean; + }>; + saveSettings: (partial: { + monospaceFont?: 'jetbrains-mono' | 'fira-code'; + monospaceLigatures?: boolean; + }) => Promise<{ + monospaceFont: 'jetbrains-mono' | 'fira-code'; + monospaceLigatures: boolean; + }>; + }; } declare global {