From 11b1c9e13e4e56041f4eb933b38497b89da7122e Mon Sep 17 00:00:00 2001 From: Amit Haridas Date: Sun, 23 Aug 2026 08:49:18 +0530 Subject: [PATCH] feat(settings): expose monospace font toggle in Settings UI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a View > Monospace Font menu (font family radio + ligatures checkbox) — the app's existing reachable UI surface for this class of preference (mirrors Theme/Font Size/Spell Check). The menu sends the change to the renderer, which persists it via the already-working ipcMain.handle('set-monospace-settings', ...) and applies it live via the same applyMonospaceClasses() used on initial load. Amit Haridas --- src/main.js | 38 ++++++++++++++++++++++++++++++++++++++ src/renderer.js | 11 +++++++++++ 2 files changed, 49 insertions(+) diff --git a/src/main.js b/src/main.js index c12970c..64215be 100644 --- a/src/main.js +++ b/src/main.js @@ -1218,6 +1218,44 @@ function createMenu() { { type: 'separator', }, + { + label: 'Monospace Font', + submenu: [ + { + label: 'JetBrains Mono', + type: 'radio', + checked: readSettingsJsonCached().monospaceFont !== 'fira-code', + click: () => + mainWindow.webContents.send('monospace-setting-change', { + monospaceFont: 'jetbrains-mono', + }), + }, + { + label: 'Fira Code', + type: 'radio', + checked: readSettingsJsonCached().monospaceFont === 'fira-code', + click: () => + mainWindow.webContents.send('monospace-setting-change', { + monospaceFont: 'fira-code', + }), + }, + { + type: 'separator', + }, + { + label: 'Ligatures', + type: 'checkbox', + checked: readSettingsJsonCached().monospaceLigatures === true, + click: (menuItem) => + mainWindow.webContents.send('monospace-setting-change', { + monospaceLigatures: menuItem.checked, + }), + }, + ], + }, + { + type: 'separator', + }, { label: 'Spell Check', type: 'checkbox', diff --git a/src/renderer.js b/src/renderer.js index caaca59..892dc64 100644 --- a/src/renderer.js +++ b/src/renderer.js @@ -1875,6 +1875,17 @@ document.addEventListener('DOMContentLoaded', async () => { applyMonospaceClasses(null); } + // Reachable UI control: View > Monospace Font menu (main.js) sends the + // requested change here; persist it via the existing setter and apply it + // live the same way the initial load above does. + ipcRenderer.on('monospace-setting-change', (event, partial) => { + if (!window.electronAPI || typeof window.electronAPI.invoke !== 'function') return; + window.electronAPI + .invoke('set-monospace-settings', partial) + .then(applyMonospaceClasses) + .catch(() => {}); + }); + // Welcome tab on startup const hasLaunched = localStorage.getItem('hasLaunchedBefore'); const showWelcome = localStorage.getItem('showWelcomeOnStartup') !== 'false';