diff --git a/package.json b/package.json index a0ab678..70c0431 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "open-terminal", "productName": "OpenTerminal", - "version": "1.0.2", + "version": "1.0.3", "description": "Open-source terminal with SSH, split panes, themes and fonts", "main": "out/main/index.js", "author": "Bill", diff --git a/src/main/tray.ts b/src/main/tray.ts index 68f89a0..ab0b7a5 100644 --- a/src/main/tray.ts +++ b/src/main/tray.ts @@ -34,7 +34,7 @@ function showMainWindow(showOrCreate: () => void): void { /** Rebuild the context menu so the close-action radio items reflect settings. */ function refreshContextMenu(showOrCreate: () => void): void { if (!tray) return - const action = loadSettings().system.closeAction ?? 'ask' + const action = loadSettings().system.closeAction ?? 'tray' const setAction = (value: CloseAction) => (): void => { persistCloseAction(value) refreshContextMenu(showOrCreate) @@ -86,7 +86,7 @@ function hideToTray(win: BrowserWindow): void { */ export async function onMainWindowClose(win: BrowserWindow, e: Electron.Event, showOrCreate: () => void): Promise { if (quitting) return - const action = loadSettings().system.closeAction ?? 'ask' + const action = loadSettings().system.closeAction ?? 'tray' if (action === 'tray') { e.preventDefault() hideToTray(win) diff --git a/src/renderer/src/settings/SettingsTabs.tsx b/src/renderer/src/settings/SettingsTabs.tsx index 76c8d2b..c4df929 100644 --- a/src/renderer/src/settings/SettingsTabs.tsx +++ b/src/renderer/src/settings/SettingsTabs.tsx @@ -317,6 +317,22 @@ export function SystemSettingsTab(): React.JSX.Element { /> } /> + void updateSystem({ closeAction: value })} + options={[ + { value: 'tray', label: '最小化到托盘' }, + { value: 'exit', label: '直接退出' }, + { value: 'ask', label: '每次询问' } + ]} + /> + } + />