fix: 🐛 修复 macOS 最小化到托盘后状态栏图标不显示的问题

This commit is contained in:
viarotel 2023-10-24 11:08:27 +08:00
parent 18d490f371
commit a78982673f
16 changed files with 37 additions and 16 deletions

View File

@ -63,7 +63,10 @@ jobs:
dist-release/*.deb dist-release/*.deb
dist-release/*.rpm dist-release/*.rpm
dist-release/*.tar.gz dist-release/*.tar.gz
dist-release/*.yml
dist-release/*.blockmap dist-release/*.blockmap
dist-release/latest.yml
dist-release/latest-mac.yml
dist-release/latest-linux.yml
dist-release/latest-linux-arm64.yml
env: env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

View File

@ -4,7 +4,7 @@
# Escrcpy # Escrcpy
📱 使用图形界面的 Scrcpy 显示和控制您的 Android 设备,由 Electron 驱动。 [查看更多截图](https://github.com/viarotel-org/escrcpy/tree/main/public/screenshot) 📱 使用图形界面的 Scrcpy 显示和控制您的 Android 设备,由 Electron 驱动。 [查看更多截图](https://github.com/viarotel-org/escrcpy/tree/main/screenshots)
<div style="display:flex;"> <div style="display:flex;">
<img src="https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/da63c9db7a944899b0ad27a0b67d29ae~tplv-k3u1fbpfcp-jj-mark:0:0:0:0:q75.image" alt="viarotel-escrcpy" style="width: 100%;"> <img src="https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/da63c9db7a944899b0ad27a0b67d29ae~tplv-k3u1fbpfcp-jj-mark:0:0:0:0:q75.image" alt="viarotel-escrcpy" style="width: 100%;">

View File

@ -59,7 +59,7 @@
"to": "extra", "to": "extra",
"filter": ["**/*", "!core"] "filter": ["**/*", "!core"]
}, },
"entitlementsInherit": "electron/resources/build/entitlements.mac.plist", "entitlementsInherit": "entitlements.mac.plist",
"extendInfo": { "extendInfo": {
"NSDocumentsFolderUsageDescription": "Application requests access to the user's Documents folder.", "NSDocumentsFolderUsageDescription": "Application requests access to the user's Documents folder.",
"NSDownloadsFolderUsageDescription": "Application requests access to the user's Downloads folder." "NSDownloadsFolderUsageDescription": "Application requests access to the user's Downloads folder."

View File

@ -7,12 +7,14 @@ export const desktopPath = process.env.DESKTOP_PATH
export const devPublishPath = resolve('dev-publish.yml') export const devPublishPath = resolve('dev-publish.yml')
export const logoPath = buildResolve('logo@256x256.png') export const logoPath = buildResolve('logo.png')
export const icoLogoPath = buildResolve('logo.ico') export const icoLogoPath = buildResolve('logo.ico')
export const icnsLogoPath = buildResolve('logo.icns') export const icnsLogoPath = buildResolve('logo.icns')
export const trayPath = extraResolve('tray.png') export const trayPath
export const macTrayPath = extraResolve('tray-Template.png') = process.platform === 'darwin'
? extraResolve('trayTemplate.png')
: extraResolve('tray.png')
export const adbPath export const adbPath
= process.platform === 'win32' = process.platform === 'win32'

View File

@ -1,5 +1,5 @@
import { Menu, Tray, app, dialog } from 'electron' import { Menu, Tray, app, dialog } from 'electron'
import { macTrayPath, trayPath } from '@electron/configs/index' import { trayPath } from '@electron/configs/index.js'
import appStore from '@electron/helpers/store.js' import appStore from '@electron/helpers/store.js'
export default (mainWindow) => { export default (mainWindow) => {
@ -29,9 +29,7 @@ export default (mainWindow) => {
else if (response === 1) { else if (response === 1) {
mainWindow.hide() mainWindow.hide()
const trayIcon = process.platform === 'darwin' ? macTrayPath : trayPath tray = new Tray(trayPath)
tray = new Tray(trayIcon)
tray.setToolTip('escrcpy') tray.setToolTip('escrcpy')

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 142 KiB

View File

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

View File

@ -1,21 +1,38 @@
<template> <template>
<div class="flex flex-col items-center justify-center h-full -mt-8"> <div class="flex flex-col items-center justify-center h-full -mt-8">
<div class=""> <div class="">
<img src="@/assets/logo.png" class="h-48" alt="" /> <img src="@electron/resources/build/logo.png" class="h-48" alt="" />
</div> </div>
<div class="pt-4 text-xl text-center italic text-gray-700"> <div class="pt-4 text-xl text-center italic text-gray-700">
📱 使用图形化的 📱 使用图形化的
<a class="hover:underline text-primary-500" :href="escrcpyURL" target="_blank">Scrcpy</a> <a
class="hover:underline text-primary-500"
:href="escrcpyURL"
target="_blank"
>Scrcpy</a>
显示和控制您的 Android 设备 Electron 驱动 显示和控制您的 Android 设备 Electron 驱动
</div> </div>
<div class="pt-12 pb-4"> <div class="pt-12 pb-4">
<el-button :loading="loading" type="primary" size="large" @click="handleUpdate"> <el-button
{{ loading && percent ? `正在更新中...${percent.toFixed(1)}%` : '版本检测更新' }} :loading="loading"
type="primary"
size="large"
@click="handleUpdate"
>
{{
loading && percent
? `正在更新中...${percent.toFixed(1)}%`
: "版本检测更新"
}}
</el-button> </el-button>
</div> </div>
<div class="text-sm"> <div class="text-sm">
Supported by Supported by
<a class="hover:underline text-primary-500" href="https://viarotel.github.io/" target="_blank">Viarotel</a> <a
class="hover:underline text-primary-500"
href="https://viarotel.github.io/"
target="_blank"
>Viarotel</a>
v{{ version }} v{{ version }}
</div> </div>
</div> </div>

View File

@ -31,6 +31,7 @@ export default params =>
resolve: { resolve: {
alias: { alias: {
'@': resolve('src'), '@': resolve('src'),
'@electron': resolve('electron'),
}, },
}, },
plugins: [ plugins: [