mirror of
https://github.com/viarotel-org/escrcpy.git
synced 2024-11-28 01:10:53 +01:00
fix: 🐛 Fixed the problem of minimizing the visibility of tray icons
This commit is contained in:
parent
7435122eb9
commit
b0f42aa474
@ -2,12 +2,14 @@ import { resolve } from 'node:path'
|
|||||||
import { contextBridge } from 'electron'
|
import { contextBridge } from 'electron'
|
||||||
import { cloneDeep } from 'lodash-es'
|
import { cloneDeep } from 'lodash-es'
|
||||||
|
|
||||||
export const isPackaged = process.env.IS_PACKAGED === 'true'
|
export const isPackaged = ['true'].includes(process.env.IS_PACKAGED)
|
||||||
|
|
||||||
export const extraResolve = (value) => {
|
export const extraResolve = (filePath) => {
|
||||||
return isPackaged
|
const basePath = isPackaged ? process.resourcesPath : 'electron/resources'
|
||||||
? resolve(process.resourcesPath, `extra/${value}`)
|
|
||||||
: resolve(`electron/resources/extra/${value}`)
|
const value = resolve(basePath, 'extra', filePath)
|
||||||
|
|
||||||
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
export const buildResolve = value =>
|
export const buildResolve = value =>
|
||||||
|
@ -8,8 +8,10 @@ if (process.platform === 'darwin') {
|
|||||||
fixPath()
|
fixPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
process.env.IS_PACKAGED = JSON.stringify(app.isPackaged)
|
process.env.IS_PACKAGED = String(app.isPackaged)
|
||||||
|
|
||||||
process.env.DESKTOP_PATH = app.getPath('desktop')
|
process.env.DESKTOP_PATH = app.getPath('desktop')
|
||||||
|
|
||||||
process.env.CWD = process.cwd()
|
process.env.CWD = process.cwd()
|
||||||
|
|
||||||
|
export const isPackaged = ['true'].includes(process.env.IS_PACKAGED)
|
||||||
|
@ -6,17 +6,15 @@ import remote from '@electron/remote/main'
|
|||||||
import { electronApp, optimizer } from '@electron-toolkit/utils'
|
import { electronApp, optimizer } from '@electron-toolkit/utils'
|
||||||
import { app, BrowserWindow, shell } from 'electron'
|
import { app, BrowserWindow, shell } from 'electron'
|
||||||
import contextMenu from 'electron-context-menu'
|
import contextMenu from 'electron-context-menu'
|
||||||
|
/** process.js 必须位于非依赖项的顶部 */
|
||||||
import { icnsLogoPath, icoLogoPath, logoPath } from './configs/index.js'
|
import { isPackaged } from './helpers/process.js'
|
||||||
import events from './events/index.js'
|
|
||||||
|
|
||||||
import log from './helpers/log.js'
|
import log from './helpers/log.js'
|
||||||
|
import './helpers/console.js'
|
||||||
import appStore from './helpers/store.js'
|
import appStore from './helpers/store.js'
|
||||||
|
|
||||||
// process.js 必须位于非依赖项的顶部
|
import { icnsLogoPath, icoLogoPath, logoPath } from './configs/index.js'
|
||||||
import './helpers/process.js'
|
|
||||||
|
|
||||||
import './helpers/console.js'
|
import events from './events/index.js'
|
||||||
|
|
||||||
const require = createRequire(import.meta.url)
|
const require = createRequire(import.meta.url)
|
||||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||||
@ -28,7 +26,7 @@ const debug = !!appStore.get('common.debug')
|
|||||||
if (!debug) {
|
if (!debug) {
|
||||||
log.warn(
|
log.warn(
|
||||||
'Debug Tips:',
|
'Debug Tips:',
|
||||||
'If you need to generate and view the running log, please start the debugging function on the preference setting page',
|
'If you need to generate and view the running log, please start the debugging function on the preference setting page'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +35,7 @@ contextMenu({
|
|||||||
showSelectAll: false,
|
showSelectAll: false,
|
||||||
showSearchWithGoogle: false,
|
showSearchWithGoogle: false,
|
||||||
showSaveImageAs: true,
|
showSaveImageAs: true,
|
||||||
showInspectElement: !app.isPackaged,
|
showInspectElement: !isPackaged,
|
||||||
})
|
})
|
||||||
|
|
||||||
// The built directory structure
|
// The built directory structure
|
||||||
@ -61,14 +59,13 @@ function createWindow() {
|
|||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
icon = icoLogoPath
|
icon = icoLogoPath
|
||||||
}
|
} else if (process.platform === 'darwin') {
|
||||||
else if (process.platform === 'darwin') {
|
|
||||||
icon = icnsLogoPath
|
icon = icnsLogoPath
|
||||||
}
|
}
|
||||||
|
|
||||||
mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
// 这里设置的图标仅在开发模式生效,打包后将使用应用程序图标
|
// 这里设置的图标仅在开发模式生效,打包后将使用应用程序图标
|
||||||
...(!app.isPackaged
|
...(!isPackaged
|
||||||
? {
|
? {
|
||||||
icon,
|
icon,
|
||||||
}
|
}
|
||||||
@ -101,8 +98,7 @@ function createWindow() {
|
|||||||
|
|
||||||
if (VITE_DEV_SERVER_URL) {
|
if (VITE_DEV_SERVER_URL) {
|
||||||
mainWindow.loadURL(VITE_DEV_SERVER_URL)
|
mainWindow.loadURL(VITE_DEV_SERVER_URL)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mainWindow.loadFile(path.join(process.env.DIST, 'index.html'))
|
mainWindow.loadFile(path.join(process.env.DIST, 'index.html'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ export default antfu(
|
|||||||
'dist',
|
'dist',
|
||||||
'dist-electron',
|
'dist-electron',
|
||||||
'dist-release',
|
'dist-release',
|
||||||
|
'electron/main.js',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -47,6 +48,7 @@ export default antfu(
|
|||||||
'no-new': 'off',
|
'no-new': 'off',
|
||||||
'prefer-promise-reject-errors': 'off',
|
'prefer-promise-reject-errors': 'off',
|
||||||
'no-unused-expressions': 'off',
|
'no-unused-expressions': 'off',
|
||||||
|
'sort-imports': 'off',
|
||||||
|
|
||||||
'vue/html-self-closing': 'off',
|
'vue/html-self-closing': 'off',
|
||||||
'vue/block-order': 'off',
|
'vue/block-order': 'off',
|
||||||
|
20
package.json
20
package.json
@ -25,7 +25,7 @@
|
|||||||
"electron-in-page-search": "1.3.2",
|
"electron-in-page-search": "1.3.2",
|
||||||
"nanoid": "5.0.7",
|
"nanoid": "5.0.7",
|
||||||
"pinia-plugin-persistedstate": "3.2.1",
|
"pinia-plugin-persistedstate": "3.2.1",
|
||||||
"vue": "3.4.26"
|
"vue": "3.4.21"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@antfu/eslint-config": "3.3.2",
|
"@antfu/eslint-config": "3.3.2",
|
||||||
@ -34,17 +34,17 @@
|
|||||||
"@electron-toolkit/utils": "3.0.0",
|
"@electron-toolkit/utils": "3.0.0",
|
||||||
"@electron/remote": "2.1.2",
|
"@electron/remote": "2.1.2",
|
||||||
"@intlify/unplugin-vue-i18n": "4.0.0",
|
"@intlify/unplugin-vue-i18n": "4.0.0",
|
||||||
"@unocss/reset": "0.59.4",
|
"@unocss/reset": "0.62.3",
|
||||||
"@unocss/transformer-directives": "0.59.4",
|
"@unocss/transformer-directives": "0.62.3",
|
||||||
"@viarotel-org/unocss-preset-shades": "0.8.2",
|
"@viarotel-org/unocss-preset-shades": "0.8.2",
|
||||||
"@vitejs/plugin-vue": "5.0.4",
|
"@vitejs/plugin-vue": "5.0.4",
|
||||||
"@vueuse/core": "10.9.0",
|
"@vueuse/core": "10.9.0",
|
||||||
"dayjs": "1.11.11",
|
"dayjs": "1.11.11",
|
||||||
"electron": "30.0.3",
|
"electron": "29.1.1",
|
||||||
"electron-builder": "24.13.3",
|
"electron-builder": "24.13.3",
|
||||||
"electron-context-menu": "4.0.0",
|
"electron-context-menu": "4.0.4",
|
||||||
"electron-find-in-page": "1.0.8",
|
"electron-find-in-page": "1.0.8",
|
||||||
"electron-log": "5.1.2",
|
"electron-log": "5.2.0",
|
||||||
"electron-store": "9.0.0",
|
"electron-store": "9.0.0",
|
||||||
"electron-updater": "6.1.8",
|
"electron-updater": "6.1.8",
|
||||||
"element-plus": "2.8.2",
|
"element-plus": "2.8.2",
|
||||||
@ -57,10 +57,10 @@
|
|||||||
"postcss": "8.4.38",
|
"postcss": "8.4.38",
|
||||||
"postcss-nested": "6.0.1",
|
"postcss-nested": "6.0.1",
|
||||||
"postcss-scss": "4.0.9",
|
"postcss-scss": "4.0.9",
|
||||||
"unocss": "0.59.4",
|
"unocss": "0.62.3",
|
||||||
"unplugin-auto-import": "0.17.5",
|
"unplugin-auto-import": "0.18.2",
|
||||||
"unplugin-vue-components": "0.27.0",
|
"unplugin-vue-components": "0.27.4",
|
||||||
"vite": "5.2.11",
|
"vite": "5.1.5",
|
||||||
"vite-plugin-electron": "0.28.7",
|
"vite-plugin-electron": "0.28.7",
|
||||||
"vite-plugin-electron-renderer": "0.14.5",
|
"vite-plugin-electron-renderer": "0.14.5",
|
||||||
"vite-svg-loader": "5.1.0",
|
"vite-svg-loader": "5.1.0",
|
||||||
|
@ -41,12 +41,11 @@ import { i18n } from '$/locales/index.js'
|
|||||||
|
|
||||||
import localeModel from '$/plugins/element-plus/locale.js'
|
import localeModel from '$/plugins/element-plus/locale.js'
|
||||||
import { usePreferenceStore } from '$/store/preference/index.js'
|
import { usePreferenceStore } from '$/store/preference/index.js'
|
||||||
|
|
||||||
import { useThemeStore } from '$/store/theme/index.js'
|
import { useThemeStore } from '$/store/theme/index.js'
|
||||||
import { ElMessageBox } from 'element-plus'
|
import { ElMessageBox } from 'element-plus'
|
||||||
|
|
||||||
import About from './components/About/index.vue'
|
import About from './components/About/index.vue'
|
||||||
import Device from './components/Device/index.vue'
|
import Device from './components/Device/index.vue'
|
||||||
|
|
||||||
import Preference from './components/Preference/index.vue'
|
import Preference from './components/Preference/index.vue'
|
||||||
import Quick from './components/Quick/index.vue'
|
import Quick from './components/Quick/index.vue'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user