fix(electron): default Windows close to background

Remove the one-time close prompt and remembered-choice path so Windows close behavior is always explicit and predictable. New installations now minimize to the system tray by default, while users can still choose to quit from settings.
This commit is contained in:
digua committed 2026-08-07 20:29:37 +08:00
1 parent 35880228b7
commit 3db40375b6
15 files changed
+44 -215

No files matched your search

+4 -3
View File
@@ -18,19 +18,20 @@ test('rejects unknown session landing tabs', () => {
assert.throws(() => configSchema.parse({ ui: { default_session_tab: 'unknown' } }))
})
test('defaults Windows close behavior to asking the user', () => {
test('defaults Windows close behavior to running in the background', () => {
const config = configSchema.parse({})
assert.equal(config.desktop.close_behavior, 'ask')
assert.equal(config.desktop.close_behavior, 'background')
})
test('accepts supported Windows close behaviors and rejects invalid values', () => {
for (const closeBehavior of ['ask', 'background', 'quit']) {
for (const closeBehavior of ['background', 'quit']) {
assert.equal(
configSchema.parse({ desktop: { close_behavior: closeBehavior } }).desktop.close_behavior,
closeBehavior
)
}
assert.throws(() => configSchema.parse({ desktop: { close_behavior: 'ask' } }))
assert.throws(() => configSchema.parse({ desktop: { close_behavior: 'hide-forever' } }))
})
+1 -1
View File
@@ -47,7 +47,7 @@ export const cliConfigSchema = z.object({
})
export const desktopConfigSchema = z.object({
close_behavior: z.enum(['ask', 'background', 'quit']).default('ask'),
close_behavior: z.enum(['background', 'quit']).default('background'),
})
export const configSchema = z.object({
+1 -1
View File
@@ -666,7 +666,7 @@ export interface UiConfig {
summary_strategy?: 'brief' | 'standard'
}
export type DesktopCloseBehavior = 'ask' | 'background' | 'quit'
export type DesktopCloseBehavior = 'background' | 'quit'
// ==================== 匿名使用统计 ====================