Skip to content

Commit b2072b5

Browse files
committed
✨ Support setting navigation bar title
1 parent 7a4f4c6 commit b2072b5

File tree

8 files changed

+45
-1
lines changed

8 files changed

+45
-1
lines changed

CLAUDE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ npm run build:mac # macOS universal build
9999
- `src/app/` - Core modules (window, tray, shortcuts)
100100
- `src/inject/` - Web page injection logic
101101

102+
## Documentation Guidelines
103+
104+
- **Main README**: Only include common, frequently-used parameters to avoid clutter
105+
- **CLI Documentation** (`bin/README.md`): Include ALL parameters with detailed usage examples
106+
- **Rare/Advanced Parameters**: Should have full documentation in CLI docs but minimal/no mention in main README
107+
- **Examples of rare parameters**: `--title`, `--incognito`, `--system-tray-icon`, etc.
108+
102109
### Key Configuration Files
103110

104111
- `pake.json` - App configuration

bin/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,18 @@ Hide the window instead of exiting when clicking the close button. Default is `t
224224
--hide-on-close
225225
```
226226

227+
#### [title]
228+
229+
Set the window title bar text. If not specified, the window title will be empty.
230+
231+
```shell
232+
--title <string>
233+
234+
# Examples:
235+
--title "My Application"
236+
--title "Google Translate"
237+
```
238+
227239
#### [incognito]
228240

229241
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.

bin/README_CN.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,18 @@ pake [url] [options]
232232
--incognito
233233
```
234234

235+
#### [title]
236+
237+
设置窗口标题栏文本。如果未指定,窗口标题将为空。
238+
239+
```shell
240+
--title <string>
241+
242+
# 示例:
243+
--title "我的应用"
244+
--title "音乐播放器"
245+
```
246+
235247
#### [installer-language]
236248

237249
设置 Windows 安装包语言。支持 `zh-CN``ja-JP`,更多在 [Tauri 文档](https://tauri.app/distribute/windows-installer/#internationalization)。默认为 `en-US`

bin/cli.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ program
128128
.default(DEFAULT.hideOnClose)
129129
.hideHelp(),
130130
)
131+
.addOption(new Option('--title <string>', 'Window title').hideHelp())
131132
.addOption(
132133
new Option('--incognito', 'Launch app in incognito/private mode').default(
133134
DEFAULT.incognito,

bin/helpers/merge.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export async function mergeConfig(
3434
installerLanguage,
3535
hideOnClose,
3636
incognito,
37+
title,
3738
} = options;
3839

3940
const { platform } = process;
@@ -51,6 +52,7 @@ export async function mergeConfig(
5152
disabled_web_shortcuts: disabledWebShortcuts,
5253
hide_on_close: hideOnClose,
5354
incognito: incognito,
55+
title: title || null,
5456
};
5557
Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });
5658

bin/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ export interface PakeCliOptions {
66
// Application name
77
name?: string;
88

9+
// Window title (supports Chinese characters)
10+
title?: string;
11+
912
// Application icon
1013
icon: string;
1114

src-tauri/src/app/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub struct WindowConfig {
1515
pub activation_shortcut: String,
1616
pub hide_on_close: bool,
1717
pub incognito: bool,
18+
pub title: Option<String>,
1819
}
1920

2021
#[derive(Debug, Serialize, Deserialize)]

src-tauri/src/app/window.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@ pub fn set_window(app: &mut App, config: &PakeConfig, tauri_config: &Config) ->
2828
serde_json::to_string(&window_config).unwrap()
2929
);
3030

31+
let window_title = window_config
32+
.title
33+
.as_ref()
34+
.map(|t| t.as_str())
35+
.unwrap_or("");
36+
3137
let mut window_builder = WebviewWindowBuilder::new(app, "pake", url)
32-
.title("")
38+
.title(window_title)
3339
.visible(false)
3440
.user_agent(user_agent)
3541
.resizable(window_config.resizable)

0 commit comments

Comments
 (0)