add --maximize and --start-to-tray options

This commit is contained in:
Tw93
2025-10-17 18:00:28 +08:00
parent fcf807a88d
commit fabebdbd99
12 changed files with 109 additions and 11 deletions

10
bin/cli.ts vendored
View File

@@ -99,6 +99,11 @@ program
.default(DEFAULT.alwaysOnTop)
.hideHelp(),
)
.addOption(
new Option('--maximize', 'Start window maximized')
.default(DEFAULT.maximize)
.hideHelp(),
)
.addOption(
new Option('--dark-mode', 'Force Mac app to use dark mode')
.default(DEFAULT.darkMode)
@@ -164,6 +169,11 @@ program
.default(DEFAULT.multiInstance)
.hideHelp(),
)
.addOption(
new Option('--start-to-tray', 'Start app minimized to tray')
.default(DEFAULT.startToTray)
.hideHelp(),
)
.addOption(
new Option('--installer-language <string>', 'Installer language')
.default(DEFAULT.installerLanguage)

2
bin/defaults.ts vendored
View File

@@ -5,6 +5,7 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = {
height: 780,
width: 1200,
fullscreen: false,
maximize: false,
resizable: true,
hideTitleBar: false,
alwaysOnTop: false,
@@ -28,6 +29,7 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = {
enableDragDrop: false,
keepBinary: false,
multiInstance: false,
startToTray: false,
};
// Just for cli development

View File

@@ -49,6 +49,7 @@ export async function mergeConfig(
width,
height,
fullscreen,
maximize,
hideTitleBar,
alwaysOnTop,
appVersion,
@@ -71,6 +72,7 @@ export async function mergeConfig(
wasm,
enableDragDrop,
multiInstance,
startToTray,
} = options;
const { platform } = process;
@@ -81,6 +83,7 @@ export async function mergeConfig(
width,
height,
fullscreen,
maximize,
resizable,
hide_title_bar: hideTitleBar,
activation_shortcut: activationShortcut,
@@ -92,6 +95,7 @@ export async function mergeConfig(
title: title || null,
enable_wasm: wasm,
enable_drag_drop: enableDragDrop,
start_to_tray: startToTray && showSystemTray,
};
Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });

6
bin/types.ts vendored
View File

@@ -24,6 +24,9 @@ export interface PakeCliOptions {
// Whether the window can be fullscreen, default false
fullscreen: boolean;
// Start window maximized, default false
maximize: boolean;
// Enable immersive header, default false.
hideTitleBar: boolean;
@@ -90,6 +93,9 @@ export interface PakeCliOptions {
// Allow multiple instances, default false (single instance)
multiInstance: boolean;
// Start app minimized to tray, default false
startToTray: boolean;
}
export interface PakeAppOptions extends PakeCliOptions {