🐛 Optimize the multi-platform experience of hide on close

This commit is contained in:
Tw93
2025-08-31 15:02:25 +08:00
parent a7f1fa1b40
commit 85943b8134
9 changed files with 54 additions and 20 deletions

2
bin/cli.ts vendored
View File

@@ -125,7 +125,7 @@ program
.hideHelp(),
)
.addOption(
new Option('--hide-on-close', 'Hide window on close instead of exiting')
new Option('--hide-on-close', 'Hide window on close instead of exiting (default: true for macOS, false for others)')
.default(DEFAULT.hideOnClose)
.hideHelp(),
)

2
bin/defaults.ts vendored
View File

@@ -22,7 +22,7 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = {
debug: false,
inject: [],
installerLanguage: 'en-US',
hideOnClose: true,
hideOnClose: undefined, // Platform-specific: true for macOS, false for others
incognito: false,
wasm: false,
};

View File

@@ -65,6 +65,9 @@ export async function mergeConfig(
const { platform } = process;
// Platform-specific hide_on_close behavior: macOS keeps true, others default to false
const platformHideOnClose = hideOnClose ?? (platform === 'darwin');
// Set Windows parameters.
const tauriConfWindowOptions = {
width,
@@ -76,7 +79,7 @@ export async function mergeConfig(
always_on_top: alwaysOnTop,
dark_mode: darkMode,
disabled_web_shortcuts: disabledWebShortcuts,
hide_on_close: hideOnClose,
hide_on_close: platformHideOnClose,
incognito: incognito,
title: title || null,
enable_wasm: wasm,

4
bin/types.ts vendored
View File

@@ -73,8 +73,8 @@ export interface PakeCliOptions {
// Installer language, valid for Windows users, default is en-US
installerLanguage: string;
// Hide window on close instead of exiting, default false
hideOnClose: boolean;
// Hide window on close instead of exiting, platform-specific: true for macOS, false for others
hideOnClose: boolean | undefined;
// Launch app in incognito/private mode, default false
incognito: boolean;