优化配套pake-cli命令1文档

This commit is contained in:
Tlntin
2022-12-28 23:53:18 +08:00
parent 1504149635
commit 88f3a9ada6
4 changed files with 130 additions and 9 deletions

32
bin/README.md vendored
View File

@@ -88,3 +88,35 @@ url 为你需要打包的网页链接 🔗,必须提供。
```shell ```shell
--fullscreen <value> --fullscreen <value>
``` ```
#### [user-agent]
自定义浏览器请求头, 默认为空。
```shell
--user-agent <value>
```
#### [show-menu]
显示菜单栏, 默认不显示
```shell
--show-menu
```
#### [show-system-tray]
显示通知栏托盘, 默认不显示
```shell
--show-system-tray <value>
```
#### [system-tray-icon]
通知栏托盘图标,仅当显示通知栏托盘时有效, 图标必须为.ico或者.png格式的512*512像素的图片。
```shell
--system-tray-icon <value>
```

32
bin/README_EN.md vendored
View File

@@ -87,3 +87,35 @@ Whether to open the full screen after opening the application. The default is `f
```shell ```shell
--fullscreen <value> --fullscreen <value>
``` ```
#### [user-agent]
Custom browser user agent, default is empty.
```shell
--user-agent <value>
```
#### [show-menu]
Display the menu bar, not display it by default.
```shell
--show-menu
```
#### [show-system-tray]
Display the notification tray, not display it by default.
```shell
--show-system-tray <value>
```
#### [system-tray-icon]
The notification tray icon is only valid when the notification tray is displayed. The icon must be a 512*512 pixel image in .ico or .png format.
```shell
--system-tray-icon <value>
```

View File

@@ -119,6 +119,18 @@ export async function mergeTauriConfig(
if (process.platform === "darwin") { if (process.platform === "darwin") {
tauriConf.pake.user_agent.macos = true; tauriConf.pake.user_agent.macos = true;
} }
} else {
if (process.platform === "win32") {
tauriConf.pake.menu.windows = false;
}
if (process.platform === "linux") {
tauriConf.pake.menu.linux = false;
}
if (process.platform === "darwin") {
tauriConf.pake.user_agent.macos = false;
}
} }
// 处理托盘 // 处理托盘
@@ -134,6 +146,18 @@ export async function mergeTauriConfig(
if (process.platform === "darwin") { if (process.platform === "darwin") {
tauriConf.pake.system_tray.macos = true; tauriConf.pake.system_tray.macos = true;
} }
} else {
if (process.platform === "win32") {
tauriConf.pake.system_tray.windows = false;
}
if (process.platform === "linux") {
tauriConf.pake.system_tray.linux = false;
}
if (process.platform === "darwin") {
tauriConf.pake.system_tray.macos = false;
}
} }
tauriConf.package.productName = name; tauriConf.package.productName = name;

51
dist/cli.js vendored
View File

@@ -1709,6 +1709,17 @@ function mergeTauriConfig(url, options, tauriConf) {
tauriConf.pake.user_agent.macos = true; tauriConf.pake.user_agent.macos = true;
} }
} }
else {
if (process.platform === "win32") {
tauriConf.pake.menu.windows = false;
}
if (process.platform === "linux") {
tauriConf.pake.menu.linux = false;
}
if (process.platform === "darwin") {
tauriConf.pake.user_agent.macos = false;
}
}
// 处理托盘 // 处理托盘
if (showSystemTray) { if (showSystemTray) {
if (process.platform === "win32") { if (process.platform === "win32") {
@@ -1721,6 +1732,17 @@ function mergeTauriConfig(url, options, tauriConf) {
tauriConf.pake.system_tray.macos = true; tauriConf.pake.system_tray.macos = true;
} }
} }
else {
if (process.platform === "win32") {
tauriConf.pake.system_tray.windows = false;
}
if (process.platform === "linux") {
tauriConf.pake.system_tray.linux = false;
}
if (process.platform === "darwin") {
tauriConf.pake.system_tray.macos = false;
}
}
tauriConf.package.productName = name; tauriConf.package.productName = name;
tauriConf.tauri.bundle.identifier = identifier; tauriConf.tauri.bundle.identifier = identifier;
// 处理应用图标 // 处理应用图标
@@ -1977,22 +1999,29 @@ var tauri$3 = {
active: false active: false
}, },
systemTray: { systemTray: {
iconPath: "/home/tlntin/data/code/rust_study/Pake/src-tauri/png/code_512.png", iconPath: "png/weread_512.png",
iconAsTemplate: true iconAsTemplate: true
} }
}; };
var build = {
devPath: "../dist",
distDir: "../dist",
beforeBuildCommand: "",
beforeDevCommand: ""
};
var CommonConf = { var CommonConf = {
"package": { "package": {
productName: "baidu", productName: "WeRead",
version: "1.0.0" version: "1.0.0"
}, },
tauri: tauri$3 tauri: tauri$3,
build: build
}; };
var windows = [ var windows = [
{ {
url: "https://www.baidu.com", url: "https://weread.qq.com/",
transparent: false, transparent: true,
fullscreen: false, fullscreen: false,
width: 1200, width: 1200,
height: 780, height: 780,
@@ -2007,7 +2036,7 @@ var user_agent = {
}; };
var menu = { var menu = {
macos: true, macos: true,
linux: true, linux: false,
windows: false windows: false
}; };
var system_tray = { var system_tray = {
@@ -2094,9 +2123,10 @@ var MacConf = {
var tauri = { var tauri = {
bundle: { bundle: {
icon: [ icon: [
"/home/tlntin/data/code/rust_study/Pake/src-tauri/png/code_512.png" "png/weread_256.ico",
"png/weread_512.png"
], ],
identifier: "pake-f9751d", identifier: "com.tw93.weread",
active: true, active: true,
category: "DeveloperTool", category: "DeveloperTool",
copyright: "", copyright: "",
@@ -2112,7 +2142,10 @@ var tauri = {
"librsvg2-dev", "librsvg2-dev",
"gnome-video-effects", "gnome-video-effects",
"gnome-video-effects-extra" "gnome-video-effects-extra"
] ],
files: {
"/usr/share/applications/com-tw93-weread.desktop": "assets/com-tw93-weread.desktop"
}
}, },
externalBin: [ externalBin: [
], ],