✨ Support setting navigation bar title
This commit is contained in:
@@ -99,6 +99,13 @@ npm run build:mac # macOS universal build
|
|||||||
- `src/app/` - Core modules (window, tray, shortcuts)
|
- `src/app/` - Core modules (window, tray, shortcuts)
|
||||||
- `src/inject/` - Web page injection logic
|
- `src/inject/` - Web page injection logic
|
||||||
|
|
||||||
|
## Documentation Guidelines
|
||||||
|
|
||||||
|
- **Main README**: Only include common, frequently-used parameters to avoid clutter
|
||||||
|
- **CLI Documentation** (`bin/README.md`): Include ALL parameters with detailed usage examples
|
||||||
|
- **Rare/Advanced Parameters**: Should have full documentation in CLI docs but minimal/no mention in main README
|
||||||
|
- **Examples of rare parameters**: `--title`, `--incognito`, `--system-tray-icon`, etc.
|
||||||
|
|
||||||
### Key Configuration Files
|
### Key Configuration Files
|
||||||
|
|
||||||
- `pake.json` - App configuration
|
- `pake.json` - App configuration
|
||||||
|
|||||||
12
bin/README.md
vendored
12
bin/README.md
vendored
@@ -224,6 +224,18 @@ Hide the window instead of exiting when clicking the close button. Default is `t
|
|||||||
--hide-on-close
|
--hide-on-close
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### [title]
|
||||||
|
|
||||||
|
Set the window title bar text. If not specified, the window title will be empty.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
--title <string>
|
||||||
|
|
||||||
|
# Examples:
|
||||||
|
--title "My Application"
|
||||||
|
--title "Google Translate"
|
||||||
|
```
|
||||||
|
|
||||||
#### [incognito]
|
#### [incognito]
|
||||||
|
|
||||||
Launch the application in incognito/private browsing mode. Default is `false`. When enabled, the webview will run in private mode, which means it won't store cookies, local storage, or browsing history. This is useful for privacy-sensitive applications.
|
Launch the application in incognito/private browsing mode. Default is `false`. When enabled, the webview will run in private mode, which means it won't store cookies, local storage, or browsing history. This is useful for privacy-sensitive applications.
|
||||||
|
|||||||
12
bin/README_CN.md
vendored
12
bin/README_CN.md
vendored
@@ -232,6 +232,18 @@ pake [url] [options]
|
|||||||
--incognito
|
--incognito
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### [title]
|
||||||
|
|
||||||
|
设置窗口标题栏文本。如果未指定,窗口标题将为空。
|
||||||
|
|
||||||
|
```shell
|
||||||
|
--title <string>
|
||||||
|
|
||||||
|
# 示例:
|
||||||
|
--title "我的应用"
|
||||||
|
--title "音乐播放器"
|
||||||
|
```
|
||||||
|
|
||||||
#### [installer-language]
|
#### [installer-language]
|
||||||
|
|
||||||
设置 Windows 安装包语言。支持 `zh-CN`、`ja-JP`,更多在 [Tauri 文档](https://tauri.app/distribute/windows-installer/#internationalization)。默认为 `en-US`。
|
设置 Windows 安装包语言。支持 `zh-CN`、`ja-JP`,更多在 [Tauri 文档](https://tauri.app/distribute/windows-installer/#internationalization)。默认为 `en-US`。
|
||||||
|
|||||||
1
bin/cli.ts
vendored
1
bin/cli.ts
vendored
@@ -128,6 +128,7 @@ program
|
|||||||
.default(DEFAULT.hideOnClose)
|
.default(DEFAULT.hideOnClose)
|
||||||
.hideHelp(),
|
.hideHelp(),
|
||||||
)
|
)
|
||||||
|
.addOption(new Option('--title <string>', 'Window title').hideHelp())
|
||||||
.addOption(
|
.addOption(
|
||||||
new Option('--incognito', 'Launch app in incognito/private mode').default(
|
new Option('--incognito', 'Launch app in incognito/private mode').default(
|
||||||
DEFAULT.incognito,
|
DEFAULT.incognito,
|
||||||
|
|||||||
2
bin/helpers/merge.ts
vendored
2
bin/helpers/merge.ts
vendored
@@ -34,6 +34,7 @@ export async function mergeConfig(
|
|||||||
installerLanguage,
|
installerLanguage,
|
||||||
hideOnClose,
|
hideOnClose,
|
||||||
incognito,
|
incognito,
|
||||||
|
title,
|
||||||
} = options;
|
} = options;
|
||||||
|
|
||||||
const { platform } = process;
|
const { platform } = process;
|
||||||
@@ -51,6 +52,7 @@ export async function mergeConfig(
|
|||||||
disabled_web_shortcuts: disabledWebShortcuts,
|
disabled_web_shortcuts: disabledWebShortcuts,
|
||||||
hide_on_close: hideOnClose,
|
hide_on_close: hideOnClose,
|
||||||
incognito: incognito,
|
incognito: incognito,
|
||||||
|
title: title || null,
|
||||||
};
|
};
|
||||||
Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });
|
Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });
|
||||||
|
|
||||||
|
|||||||
3
bin/types.ts
vendored
3
bin/types.ts
vendored
@@ -6,6 +6,9 @@ export interface PakeCliOptions {
|
|||||||
// Application name
|
// Application name
|
||||||
name?: string;
|
name?: string;
|
||||||
|
|
||||||
|
// Window title (supports Chinese characters)
|
||||||
|
title?: string;
|
||||||
|
|
||||||
// Application icon
|
// Application icon
|
||||||
icon: string;
|
icon: string;
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ pub struct WindowConfig {
|
|||||||
pub activation_shortcut: String,
|
pub activation_shortcut: String,
|
||||||
pub hide_on_close: bool,
|
pub hide_on_close: bool,
|
||||||
pub incognito: bool,
|
pub incognito: bool,
|
||||||
|
pub title: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
|||||||
@@ -28,8 +28,14 @@ pub fn set_window(app: &mut App, config: &PakeConfig, tauri_config: &Config) ->
|
|||||||
serde_json::to_string(&window_config).unwrap()
|
serde_json::to_string(&window_config).unwrap()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let window_title = window_config
|
||||||
|
.title
|
||||||
|
.as_ref()
|
||||||
|
.map(|t| t.as_str())
|
||||||
|
.unwrap_or("");
|
||||||
|
|
||||||
let mut window_builder = WebviewWindowBuilder::new(app, "pake", url)
|
let mut window_builder = WebviewWindowBuilder::new(app, "pake", url)
|
||||||
.title("")
|
.title(window_title)
|
||||||
.visible(false)
|
.visible(false)
|
||||||
.user_agent(user_agent)
|
.user_agent(user_agent)
|
||||||
.resizable(window_config.resizable)
|
.resizable(window_config.resizable)
|
||||||
|
|||||||
Reference in New Issue
Block a user