From 88f3a9ada6193531d385e212c82bfb4116837ef1 Mon Sep 17 00:00:00 2001 From: Tlntin Date: Wed, 28 Dec 2022 23:53:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=85=8D=E5=A5=97pake-cli?= =?UTF-8?q?=E5=91=BD=E4=BB=A41=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/README.md | 32 ++++++++++++++++++++++++++ bin/README_EN.md | 32 ++++++++++++++++++++++++++ bin/builders/common.ts | 24 ++++++++++++++++++++ dist/cli.js | 51 ++++++++++++++++++++++++++++++++++-------- 4 files changed, 130 insertions(+), 9 deletions(-) diff --git a/bin/README.md b/bin/README.md index b6b8bc4..bf10e65 100644 --- a/bin/README.md +++ b/bin/README.md @@ -88,3 +88,35 @@ url 为你需要打包的网页链接 🔗,必须提供。 ```shell --fullscreen ``` + +#### [user-agent] + +自定义浏览器请求头, 默认为空。 + +```shell +--user-agent +``` + +#### [show-menu] + +显示菜单栏, 默认不显示 + +```shell +--show-menu +``` + +#### [show-system-tray] + +显示通知栏托盘, 默认不显示 + +```shell +--show-system-tray +``` + +#### [system-tray-icon] + +通知栏托盘图标,仅当显示通知栏托盘时有效, 图标必须为.ico或者.png格式的,512*512像素的图片。 + +```shell +--system-tray-icon +``` \ No newline at end of file diff --git a/bin/README_EN.md b/bin/README_EN.md index 683e9d7..e205b6c 100644 --- a/bin/README_EN.md +++ b/bin/README_EN.md @@ -87,3 +87,35 @@ Whether to open the full screen after opening the application. The default is `f ```shell --fullscreen ``` + +#### [user-agent] + +Custom browser user agent, default is empty. + +```shell +--user-agent +``` + +#### [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 +``` + +#### [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 +``` diff --git a/bin/builders/common.ts b/bin/builders/common.ts index 07e14ba..212e330 100644 --- a/bin/builders/common.ts +++ b/bin/builders/common.ts @@ -119,6 +119,18 @@ export async function mergeTauriConfig( if (process.platform === "darwin") { 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") { 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; diff --git a/dist/cli.js b/dist/cli.js index 1a5f29f..4f5aafa 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -1709,6 +1709,17 @@ function mergeTauriConfig(url, options, tauriConf) { 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 (process.platform === "win32") { @@ -1721,6 +1732,17 @@ function mergeTauriConfig(url, options, tauriConf) { 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.tauri.bundle.identifier = identifier; // 处理应用图标 @@ -1977,22 +1999,29 @@ var tauri$3 = { active: false }, systemTray: { - iconPath: "/home/tlntin/data/code/rust_study/Pake/src-tauri/png/code_512.png", + iconPath: "png/weread_512.png", iconAsTemplate: true } }; +var build = { + devPath: "../dist", + distDir: "../dist", + beforeBuildCommand: "", + beforeDevCommand: "" +}; var CommonConf = { "package": { - productName: "baidu", + productName: "WeRead", version: "1.0.0" }, - tauri: tauri$3 + tauri: tauri$3, + build: build }; var windows = [ { - url: "https://www.baidu.com", - transparent: false, + url: "https://weread.qq.com/", + transparent: true, fullscreen: false, width: 1200, height: 780, @@ -2007,7 +2036,7 @@ var user_agent = { }; var menu = { macos: true, - linux: true, + linux: false, windows: false }; var system_tray = { @@ -2094,9 +2123,10 @@ var MacConf = { var tauri = { bundle: { 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, category: "DeveloperTool", copyright: "", @@ -2112,7 +2142,10 @@ var tauri = { "librsvg2-dev", "gnome-video-effects", "gnome-video-effects-extra" - ] + ], + files: { + "/usr/share/applications/com-tw93-weread.desktop": "assets/com-tw93-weread.desktop" + } }, externalBin: [ ],