feat: close-to-tray default + system settings entry; bump 1.0.3
This commit is contained in:
1 parent
8f686f56ca
commit
2b3fefafd0
4 files changed
+20
-4
No files matched your search
+2
-2
@@ -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<void> {
|
||||
if (quitting) return
|
||||
const action = loadSettings().system.closeAction ?? 'ask'
|
||||
const action = loadSettings().system.closeAction ?? 'tray'
|
||||
if (action === 'tray') {
|
||||
e.preventDefault()
|
||||
hideToTray(win)
|
||||
|
||||
@@ -317,6 +317,22 @@ export function SystemSettingsTab(): React.JSX.Element {
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<SettingRow
|
||||
label="关闭按钮行为"
|
||||
desc="点击窗口关闭按钮时的动作;最小化到托盘后可在托盘图标右键菜单中退出"
|
||||
control={
|
||||
<Select
|
||||
className="settings-select"
|
||||
value={settings.system.closeAction ?? 'tray'}
|
||||
onChange={(value) => void updateSystem({ closeAction: value })}
|
||||
options={[
|
||||
{ value: 'tray', label: '最小化到托盘' },
|
||||
{ value: 'exit', label: '直接退出' },
|
||||
{ value: 'ask', label: '每次询问' }
|
||||
]}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<SettingRow
|
||||
label="全局唤起快捷键"
|
||||
desc="Control+Shift+Alt+T 等,留空禁用"
|
||||
|
||||
@@ -107,5 +107,5 @@ export const DEFAULT_SETTINGS: AppSettings = {
|
||||
},
|
||||
customThemes: [],
|
||||
highlightRules: DEFAULT_HIGHLIGHT_RULES,
|
||||
system: { launchAtLogin: false, preventSleep: false, globalShowHide: '', closeAction: 'ask', autoCheckUpdate: true }
|
||||
system: { launchAtLogin: false, preventSleep: false, globalShowHide: '', closeAction: 'tray', autoCheckUpdate: true }
|
||||
}
|
||||
Reference in new issue
Block a user