Support Mac dark mode

This commit is contained in:
Tw93
2024-09-11 19:16:00 +08:00
parent caa50f632b
commit a285a83269
9 changed files with 33 additions and 2 deletions

8
bin/README.md vendored
View File

@@ -146,6 +146,14 @@ Sets whether the window is always at the top level, defaults to `false`.
--always-on-top
```
#### [dark-mode]
Force Mac to package applications using dark mode, default is `false`.
```shell
--dark-mode
```
#### [disabled-web-shortcuts]
Sets whether to disable web shortcuts in the original Pake container, defaults to `false`.

8
bin/README_CN.md vendored
View File

@@ -146,6 +146,14 @@ pake [url] [options]
--always-on-top
```
#### [dark-mode]
强制 Mac 打包应用使用黑暗模式,默认为 `false`。
```shell
--dark-mode
```
#### [disabled-web-shortcuts]
设置是否禁用原有 Pake 容器里面的网页操作快捷键,默认为 `false`。

1
bin/cli.ts vendored
View File

@@ -38,6 +38,7 @@ program
new Option('--targets <string>', 'Only for Linux, option "deb" or "appimage"').default(DEFAULT.targets).hideHelp(),
)
.addOption(new Option('--always-on-top', 'Always on the top level').default(DEFAULT.alwaysOnTop).hideHelp())
.addOption(new Option('--dark-mode', 'Force Mac app to use dark mode').default(DEFAULT.darkMode).hideHelp())
.addOption(
new Option('--disabled-web-shortcuts', 'Disabled webPage shortcuts')
.default(DEFAULT.disabledWebShortcuts)

1
bin/defaults.ts vendored
View File

@@ -8,6 +8,7 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = {
resizable: true,
hideTitleBar: false,
alwaysOnTop: false,
darkMode: false,
disabledWebShortcuts: false,
activationShortcut: '',
userAgent: '',

View File

@@ -14,6 +14,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
fullscreen,
hideTitleBar,
alwaysOnTop,
darkMode,
disabledWebShortcuts,
activationShortcut,
userAgent,
@@ -39,6 +40,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
hide_title_bar: hideTitleBar,
activation_shortcut: activationShortcut,
always_on_top: alwaysOnTop,
dark_mode: darkMode,
disabled_web_shortcuts: disabledWebShortcuts,
};
Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });

4
bin/types.ts vendored
View File

@@ -27,6 +27,10 @@ export interface PakeCliOptions {
// Enable windows always on top, default false
alwaysOnTop: boolean;
// Force Mac to use dark mode, default false
darkMode: boolean;
// Disable web shortcuts, default false
disabledWebShortcuts: boolean;