add new param hide-on-close

This commit is contained in:
Tw93
2025-08-05 15:17:02 +08:00
parent d8b8102367
commit 4a91c42e2e
16 changed files with 1223 additions and 1136 deletions

8
bin/README.md vendored
View File

@@ -208,6 +208,14 @@ Specify the system tray icon. This is only effective when the system tray is ena
--system-tray-icon <path>
```
#### [hide-on-close]
Hide the window instead of exiting when clicking the close button. Default is `true`. When enabled, the application will be minimized to the system tray (if available) or hidden when the close button is clicked, rather than actually closing the application.
```shell
--hide-on-close
```
#### [installer-language]
Set the Windows Installer language. Options include `zh-CN`, `ja-JP`, More at [Tauri Document](https://tauri.app/distribute/windows-installer/#internationalization). Default is `en-US`.

8
bin/README_CN.md vendored
View File

@@ -208,6 +208,14 @@ pake [url] [options]
--system-tray-icon <path>
```
#### [hide-on-close]
设置点击关闭按钮时隐藏窗口而不是退出应用。默认为 `true`。启用后,点击关闭按钮时应用会最小化到系统托盘(如果可用)或隐藏窗口,而不是直接关闭应用程序。
```shell
--hide-on-close
```
#### [installer-language]
设置 Windows 安装包语言。支持 `zh-CN`、`ja-JP`,更多在 [Tauri 文档](https://tauri.app/distribute/windows-installer/#internationalization)。默认为 `en-US`。

1
bin/cli.ts vendored
View File

@@ -44,6 +44,7 @@ program
)
.addOption(new Option('--show-system-tray', 'Show system tray in app').default(DEFAULT.showSystemTray).hideHelp())
.addOption(new Option('--system-tray-icon <string>', 'Custom system tray icon').default(DEFAULT.systemTrayIcon).hideHelp())
.addOption(new Option('--hide-on-close', 'Hide window on close instead of exiting').default(DEFAULT.hideOnClose).hideHelp())
.addOption(new Option('--installer-language <string>', 'Installer language').default(DEFAULT.installerLanguage).hideHelp())
.version(packageJson.version, '-v, --version', 'Output the current version')
.action(async (url: string, options: PakeCliOptions) => {

1
bin/defaults.ts vendored
View File

@@ -22,6 +22,7 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = {
debug: false,
inject: [],
installerLanguage: 'en-US',
hideOnClose: true,
};
// Just for cli development

View File

@@ -28,6 +28,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
inject,
proxyUrl,
installerLanguage,
hideOnClose,
} = options;
const { platform } = process;
@@ -43,6 +44,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
always_on_top: alwaysOnTop,
dark_mode: darkMode,
disabled_web_shortcuts: disabledWebShortcuts,
hide_on_close: hideOnClose,
};
Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });

3
bin/types.ts vendored
View File

@@ -68,6 +68,9 @@ 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;
}
export interface PakeAppOptions extends PakeCliOptions {