mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-10-25 17:54:34 +08:00
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.
21 lines
553 B
TypeScript
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)
|
|
}
|
|
}
|