From 2ea7941050130edc8f54540cf6d30faffca26f25 Mon Sep 17 00:00:00 2001 From: Douwe Osinga Date: Mon, 26 Jan 2026 10:41:32 -0500 Subject: [PATCH] Remove some more comments --- .../settings/keyboard/KeyboardShortcutsSection.tsx | 7 ------- ui/desktop/src/main.ts | 9 +-------- ui/desktop/src/utils/settings.ts | 1 - 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/ui/desktop/src/components/settings/keyboard/KeyboardShortcutsSection.tsx b/ui/desktop/src/components/settings/keyboard/KeyboardShortcutsSection.tsx index 8a100120b9..38f5c32819 100644 --- a/ui/desktop/src/components/settings/keyboard/KeyboardShortcutsSection.tsx +++ b/ui/desktop/src/components/settings/keyboard/KeyboardShortcutsSection.tsx @@ -182,13 +182,11 @@ export default function KeyboardShortcutsSection() { const handleSave = async (shortcut: string) => { if (!shortcuts || !editingKey) return; - // Check if this shortcut is already used by another action const conflictingKey = Object.entries(shortcuts).find( ([key, value]) => key !== editingKey && value === shortcut )?.[0]; if (conflictingKey) { - // Show confirmation dialog const confirmed = await window.electron.showMessageBox({ type: 'warning', title: 'Shortcut Conflict', @@ -199,20 +197,16 @@ export default function KeyboardShortcutsSection() { }); if (confirmed.response !== 0) { - // User cancelled return; } } - // Create new shortcuts, clearing any conflicts const newShortcuts = { ...shortcuts }; - // Clear the shortcut from any conflicting action if (conflictingKey) { newShortcuts[conflictingKey as keyof KeyboardShortcuts] = null; } - // Set the new shortcut newShortcuts[editingKey] = shortcut || null; const settings = await window.electron.getSettings(); @@ -221,7 +215,6 @@ export default function KeyboardShortcutsSection() { if (success) { setShortcuts(newShortcuts); setEditingKey(null); - // Show restart notice for non-global shortcuts if (needsRestart.has(editingKey)) { setShowRestartNotice(true); } diff --git a/ui/desktop/src/main.ts b/ui/desktop/src/main.ts index 22538754a2..59a3223c6a 100644 --- a/ui/desktop/src/main.ts +++ b/ui/desktop/src/main.ts @@ -38,7 +38,6 @@ import { getKeyboardShortcuts, } from './utils/settings'; import * as crypto from 'crypto'; -// import electron from "electron"; import * as yaml from 'yaml'; import windowStateKeeper from 'electron-window-state'; import { @@ -54,7 +53,6 @@ import { Client, createClient, createConfig } from './api/client'; import { GooseApp } from './api'; import installExtension, { REACT_DEVELOPER_TOOLS } from 'electron-devtools-installer'; -// Updater functions (moved here to keep updates.ts minimal for release replacement) function shouldSetupUpdater(): boolean { // Setup updater if either the flag is enabled OR dev updates are enabled return UPDATES_ENABLED || process.env.ENABLE_DEV_UPDATES === 'true'; @@ -1263,9 +1261,7 @@ ipcMain.handle('get-settings', () => { ipcMain.handle('save-settings', (_event, settings) => { try { const oldSettings = loadSettings(); - saveSettings(settings); - // Check if keyboard shortcuts changed and re-register them const oldShortcuts = getKeyboardShortcuts(oldSettings); const newShortcuts = getKeyboardShortcuts(settings); const shortcutsChanged = JSON.stringify(oldShortcuts) !== JSON.stringify(newShortcuts); @@ -1274,6 +1270,7 @@ ipcMain.handle('save-settings', (_event, settings) => { registerGlobalShortcuts(); } + saveSettings(settings); return true; } catch (error) { console.error('Error saving settings:', error); @@ -1813,15 +1810,12 @@ const focusWindow = () => { } }; -// Register global shortcuts based on settings const registerGlobalShortcuts = () => { - // Unregister all existing shortcuts first globalShortcut.unregisterAll(); const settings = loadSettings(); const shortcuts = getKeyboardShortcuts(settings); - // Register focus window shortcut (global) if (shortcuts.focusWindow) { try { globalShortcut.register(shortcuts.focusWindow, () => { @@ -1832,7 +1826,6 @@ const registerGlobalShortcuts = () => { } } - // Register quick launcher shortcut (global) if (shortcuts.quickLauncher) { try { globalShortcut.register(shortcuts.quickLauncher, () => { diff --git a/ui/desktop/src/utils/settings.ts b/ui/desktop/src/utils/settings.ts index b409c87ad6..1c75a59aac 100644 --- a/ui/desktop/src/utils/settings.ts +++ b/ui/desktop/src/utils/settings.ts @@ -105,7 +105,6 @@ export function updateEnvironmentVariables(envToggles: EnvToggles): void { } export function getKeyboardShortcuts(settings: Settings): KeyboardShortcuts { - // Migrate from old globalShortcut field if needed if (!settings.keyboardShortcuts && settings.globalShortcut !== undefined) { const focusShortcut = settings.globalShortcut; const launcherShortcut = focusShortcut ? focusShortcut.replace(/\+G$/i, '+Shift+G') : null;