Files
ChatLab/apps/desktop/main/window/close-behavior.ts
T
digua 3db40375b6 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.
2026-08-07 20:29:37 +08:00

21 lines
553 B
TypeScript

import type { DesktopCloseBehavior } from '@openchatlab/shared-types'
interface WindowsCloseBehaviorDependencies {
readPreference: () => DesktopCloseBehavior
enterBackground: () => void
quit: () => void
onError: (error: unknown) => void
}
export function applyWindowsCloseBehavior(dependencies: WindowsCloseBehaviorDependencies): void {
try {
if (dependencies.readPreference() === 'background') {
dependencies.enterBackground()
} else {
dependencies.quit()
}
} catch (error) {
dependencies.onError(error)
}
}