✨ Add alwaysOnTop feature
This commit is contained in:
7
bin/README.md
vendored
7
bin/README.md
vendored
@@ -121,6 +121,13 @@ Enable or disable immersive header. Default is `false`. Use the following comman
|
|||||||
--transparent
|
--transparent
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### [always-on-top]
|
||||||
|
Enable the always-on-top feature. Default is `false`.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
--always-on-top
|
||||||
|
```
|
||||||
|
|
||||||
#### [fullscreen]
|
#### [fullscreen]
|
||||||
|
|
||||||
Determine whether the application launches in full screen. Default is `false`. Use the following command to enable full screen.
|
Determine whether the application launches in full screen. Default is `false`. Use the following command to enable full screen.
|
||||||
|
|||||||
10
bin/README_CN.md
vendored
10
bin/README_CN.md
vendored
@@ -122,6 +122,16 @@ pake [url] [options]
|
|||||||
--transparent
|
--transparent
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### [always-on-top]
|
||||||
|
设置是否窗口一直在最顶层,默认为 `false`。
|
||||||
|
|
||||||
|
```shell
|
||||||
|
--always-on-top
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
```shell
|
||||||
|
|
||||||
#### [fullscreen]
|
#### [fullscreen]
|
||||||
|
|
||||||
设置应用程序是否在启动时自动全屏,默认为 `false`。使用以下命令可以设置应用程序启动时自动全屏。
|
设置应用程序是否在启动时自动全屏,默认为 `false`。使用以下命令可以设置应用程序启动时自动全屏。
|
||||||
|
|||||||
1
bin/defaults.ts
vendored
1
bin/defaults.ts
vendored
@@ -7,6 +7,7 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = {
|
|||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
transparent: false,
|
transparent: false,
|
||||||
|
alwaysOnTop: false,
|
||||||
userAgent: '',
|
userAgent: '',
|
||||||
showSystemTray: false,
|
showSystemTray: false,
|
||||||
multiArch: false,
|
multiArch: false,
|
||||||
|
|||||||
2
bin/helpers/merge.ts
vendored
2
bin/helpers/merge.ts
vendored
@@ -13,6 +13,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
|
|||||||
height,
|
height,
|
||||||
fullscreen,
|
fullscreen,
|
||||||
transparent,
|
transparent,
|
||||||
|
alwaysOnTop,
|
||||||
userAgent,
|
userAgent,
|
||||||
showSystemTray,
|
showSystemTray,
|
||||||
systemTrayIcon,
|
systemTrayIcon,
|
||||||
@@ -32,6 +33,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
|
|||||||
height,
|
height,
|
||||||
fullscreen,
|
fullscreen,
|
||||||
transparent,
|
transparent,
|
||||||
|
alwaysOnTop,
|
||||||
resizable,
|
resizable,
|
||||||
};
|
};
|
||||||
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
@@ -24,6 +24,9 @@ export interface PakeCliOptions {
|
|||||||
// Enable immersive header, default false
|
// Enable immersive header, default false
|
||||||
transparent: boolean;
|
transparent: boolean;
|
||||||
|
|
||||||
|
// Enable windows always on top, default false
|
||||||
|
alwaysOnTop: boolean;
|
||||||
|
|
||||||
// Custom User-Agent, default off
|
// Custom User-Agent, default off
|
||||||
userAgent: string;
|
userAgent: string;
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,8 @@
|
|||||||
"width": 1200,
|
"width": 1200,
|
||||||
"height": 780,
|
"height": 780,
|
||||||
"resizable": true,
|
"resizable": true,
|
||||||
"url_type": "web"
|
"url_type": "web",
|
||||||
|
"always_on_top": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"user_agent": {
|
"user_agent": {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ pub struct WindowConfig {
|
|||||||
pub height: f64,
|
pub height: f64,
|
||||||
pub resizable: bool,
|
pub resizable: bool,
|
||||||
pub url_type: String,
|
pub url_type: String,
|
||||||
|
pub always_on_top: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ pub fn get_window(app: &mut App, config: PakeConfig, _data_dir: PathBuf) -> Wind
|
|||||||
.fullscreen(window_config.fullscreen)
|
.fullscreen(window_config.fullscreen)
|
||||||
.inner_size(window_config.width, window_config.height)
|
.inner_size(window_config.width, window_config.height)
|
||||||
.disable_file_drop_handler()
|
.disable_file_drop_handler()
|
||||||
|
.always_on_top(window_config.always_on_top)
|
||||||
.initialization_script(include_str!("../inject/component.js"))
|
.initialization_script(include_str!("../inject/component.js"))
|
||||||
.initialization_script(include_str!("../inject/event.js"))
|
.initialization_script(include_str!("../inject/event.js"))
|
||||||
.initialization_script(include_str!("../inject/style.js"))
|
.initialization_script(include_str!("../inject/style.js"))
|
||||||
|
|||||||
Reference in New Issue
Block a user