Skip to content

Commit

Permalink
✨ Add alwaysOnTop feature
Browse files Browse the repository at this point in the history
  • Loading branch information
tw93 committed May 8, 2024
1 parent f531939 commit a1e34a0
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 1 deletion.
7 changes: 7 additions & 0 deletions bin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ Enable or disable immersive header. Default is `false`. Use the following comman
--transparent
```

#### [always-on-top]
Enable the always-on-top feature. Default is `false`.

```shell
--always-on-top
```

#### [fullscreen]

Determine whether the application launches in full screen. Default is `false`. Use the following command to enable full screen.
Expand Down
10 changes: 10 additions & 0 deletions bin/README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,16 @@ pake [url] [options]
--transparent
```

#### [always-on-top]
设置是否窗口一直在最顶层,默认为 `false`

```shell
--always-on-top
```


```shell
#### [fullscreen]
设置应用程序是否在启动时自动全屏,默认为 `false`。使用以下命令可以设置应用程序启动时自动全屏。
Expand Down
1 change: 1 addition & 0 deletions bin/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = {
fullscreen: false,
resizable: true,
transparent: false,
alwaysOnTop: false,
userAgent: '',
showSystemTray: false,
multiArch: false,
Expand Down
2 changes: 2 additions & 0 deletions bin/helpers/merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
height,
fullscreen,
transparent,
alwaysOnTop,
userAgent,
showSystemTray,
systemTrayIcon,
Expand All @@ -32,6 +33,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
height,
fullscreen,
transparent,
alwaysOnTop,
resizable,
};
Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });
Expand Down
3 changes: 3 additions & 0 deletions bin/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export interface PakeCliOptions {
// Enable immersive header, default false
transparent: boolean;

// Enable windows always on top, default false
alwaysOnTop: boolean;

// Custom User-Agent, default off
userAgent: string;

Expand Down
3 changes: 2 additions & 1 deletion src-tauri/pake.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"width": 1200,
"height": 780,
"resizable": true,
"url_type": "web"
"url_type": "web",
"always_on_top": false
}
],
"user_agent": {
Expand Down
1 change: 1 addition & 0 deletions src-tauri/src/app/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub struct WindowConfig {
pub height: f64,
pub resizable: bool,
pub url_type: String,
pub always_on_top: bool,
}

#[derive(Debug, Deserialize)]
Expand Down
1 change: 1 addition & 0 deletions src-tauri/src/app/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub fn get_window(app: &mut App, config: PakeConfig, _data_dir: PathBuf) -> Wind
.fullscreen(window_config.fullscreen)
.inner_size(window_config.width, window_config.height)
.disable_file_drop_handler()
.always_on_top(window_config.always_on_top)
.initialization_script(include_str!("../inject/component.js"))
.initialization_script(include_str!("../inject/event.js"))
.initialization_script(include_str!("../inject/style.js"))
Expand Down

0 comments on commit a1e34a0

Please sign in to comment.