diff --git a/ui/desktop/src/components/settings/app/AppSettingsSection.tsx b/ui/desktop/src/components/settings/app/AppSettingsSection.tsx index 91c026ef07e6..b9e11b5a5909 100644 --- a/ui/desktop/src/components/settings/app/AppSettingsSection.tsx +++ b/ui/desktop/src/components/settings/app/AppSettingsSection.tsx @@ -18,7 +18,6 @@ interface AppSettingsSectionProps { export default function AppSettingsSection({ scrollToSection }: AppSettingsSectionProps) { const [menuBarIconEnabled, setMenuBarIconEnabled] = useState(true); const [dockIconEnabled, setDockIconEnabled] = useState(true); - const [quitConfirmationEnabled, setQuitConfirmationEnabled] = useState(true); const [wakelockEnabled, setWakelockEnabled] = useState(true); const [isMacOS, setIsMacOS] = useState(false); const [isDockSwitchDisabled, setIsDockSwitchDisabled] = useState(false); @@ -144,10 +143,6 @@ export default function AppSettingsSection({ scrollToSection }: AppSettingsSecti setMenuBarIconEnabled(enabled); }); - window.electron.getQuitConfirmationState().then((enabled) => { - setQuitConfirmationEnabled(enabled); - }); - window.electron.getWakelockState().then((enabled) => { setWakelockEnabled(enabled); }); @@ -199,14 +194,6 @@ export default function AppSettingsSection({ scrollToSection }: AppSettingsSecti } }; - const handleQuitConfirmationToggle = async () => { - const newState = !quitConfirmationEnabled; - const success = await window.electron.setQuitConfirmation(newState); - if (success) { - setQuitConfirmationEnabled(newState); - } - }; - const handleWakelockToggle = async () => { const newState = !wakelockEnabled; const success = await window.electron.setWakelock(newState); @@ -295,23 +282,6 @@ export default function AppSettingsSection({ scrollToSection }: AppSettingsSecti )} - {/* Quit Confirmation */} -
-
-

Quit confirmation

-

- Show confirmation dialog when quitting the app -

-
-
- -
-
- {/* Prevent Sleep */}
diff --git a/ui/desktop/src/main.ts b/ui/desktop/src/main.ts index f154ef0d511e..874dff015878 100644 --- a/ui/desktop/src/main.ts +++ b/ui/desktop/src/main.ts @@ -1267,29 +1267,6 @@ ipcMain.handle('open-notifications-settings', async () => { } }); -// Handle quit confirmation setting -ipcMain.handle('set-quit-confirmation', async (_event, show: boolean) => { - try { - const settings = loadSettings(); - settings.showQuitConfirmation = show; - saveSettings(settings); - return true; - } catch (error) { - console.error('Error setting quit confirmation:', error); - return false; - } -}); - -ipcMain.handle('get-quit-confirmation-state', () => { - try { - const settings = loadSettings(); - return settings.showQuitConfirmation ?? true; - } catch (error) { - console.error('Error getting quit confirmation state:', error); - return true; - } -}); - // Handle wakelock setting ipcMain.handle('set-wakelock', async (_event, enable: boolean) => { try { @@ -2317,48 +2294,6 @@ app.on('will-quit', async () => { } }); -// Quit when all windows are closed, except on macOS or if we have a tray icon. -// Add confirmation dialog when quitting with Cmd+Q (skip in dev mode) -app.on('before-quit', async (event) => { - // Skip confirmation dialog in development mode - if (MAIN_WINDOW_VITE_DEV_SERVER_URL) { - return; // Allow normal quit behavior in dev mode - } - - // Check if quit confirmation is enabled in settings - const settings = loadSettings(); - if (!settings.showQuitConfirmation) { - return; // Allow normal quit behavior if confirmation is disabled - } - - // Prevent the default quit behavior - event.preventDefault(); - - // Show confirmation dialog - try { - const result = (await dialog.showMessageBox({ - type: 'question', - buttons: ['Quit', 'Cancel'], - defaultId: 1, // Default to Cancel - title: 'Confirm Quit', - message: 'Are you sure you want to quit Goose?', - detail: 'Any unsaved changes may be lost.', - })) as unknown as { response: number }; - - if (result.response === 0) { - // User clicked "Quit" - // Set a flag to avoid showing the dialog again - app.removeAllListeners('before-quit'); - // Force quit the app - process.nextTick(() => { - app.exit(0); - }); - } - } catch (error) { - console.error('Error showing quit dialog:', error); - } -}); - app.on('window-all-closed', () => { // Only quit if we're not on macOS or don't have a tray icon if (process.platform !== 'darwin' || !tray) { diff --git a/ui/desktop/src/preload.ts b/ui/desktop/src/preload.ts index 8de1613fce1d..17f535078966 100644 --- a/ui/desktop/src/preload.ts +++ b/ui/desktop/src/preload.ts @@ -79,8 +79,6 @@ type ElectronAPI = { getSettings: () => Promise; getSecretKey: () => Promise; setSchedulingEngine: (engine: string) => Promise; - setQuitConfirmation: (show: boolean) => Promise; - getQuitConfirmationState: () => Promise; setWakelock: (enable: boolean) => Promise; getWakelockState: () => Promise; openNotificationsSettings: () => Promise; @@ -177,8 +175,6 @@ const electronAPI: ElectronAPI = { getSettings: () => ipcRenderer.invoke('get-settings'), getSecretKey: () => ipcRenderer.invoke('get-secret-key'), setSchedulingEngine: (engine: string) => ipcRenderer.invoke('set-scheduling-engine', engine), - setQuitConfirmation: (show: boolean) => ipcRenderer.invoke('set-quit-confirmation', show), - getQuitConfirmationState: () => ipcRenderer.invoke('get-quit-confirmation-state'), setWakelock: (enable: boolean) => ipcRenderer.invoke('set-wakelock', enable), getWakelockState: () => ipcRenderer.invoke('get-wakelock-state'), openNotificationsSettings: () => ipcRenderer.invoke('open-notifications-settings'), diff --git a/ui/desktop/src/utils/settings.ts b/ui/desktop/src/utils/settings.ts index 5fb1d64a41a3..84e0a127cd90 100644 --- a/ui/desktop/src/utils/settings.ts +++ b/ui/desktop/src/utils/settings.ts @@ -15,7 +15,6 @@ export interface Settings { showMenuBarIcon: boolean; showDockIcon: boolean; schedulingEngine: SchedulingEngine; - showQuitConfirmation: boolean; enableWakelock: boolean; } @@ -30,7 +29,6 @@ const defaultSettings: Settings = { showMenuBarIcon: true, showDockIcon: true, schedulingEngine: 'builtin-cron', - showQuitConfirmation: true, enableWakelock: false, };