mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-24 23:06:51 +00:00
fix: 修复linux图标问题
This commit is contained in:
@@ -281,12 +281,18 @@ const requestMainWindowCloseConfirmation = (win: BrowserWindow): void => {
|
|||||||
function createWindow(options: { autoShow?: boolean } = {}) {
|
function createWindow(options: { autoShow?: boolean } = {}) {
|
||||||
// 获取图标路径 - 打包后在 resources 目录
|
// 获取图标路径 - 打包后在 resources 目录
|
||||||
const { autoShow = true } = options
|
const { autoShow = true } = options
|
||||||
|
let iconName = 'icon.ico';
|
||||||
|
if (process.platform === 'linux') {
|
||||||
|
iconName = 'icon.png';
|
||||||
|
} else if (process.platform === 'darwin') {
|
||||||
|
iconName = 'icon.icns';
|
||||||
|
}
|
||||||
|
|
||||||
const isDev = !!process.env.VITE_DEV_SERVER_URL
|
const isDev = !!process.env.VITE_DEV_SERVER_URL
|
||||||
|
|
||||||
const iconPath = isDev
|
const iconPath = isDev
|
||||||
? join(__dirname, '../public/icon.ico')
|
? join(__dirname, `../public/${iconName}`)
|
||||||
: (process.platform === 'darwin'
|
: join(process.resourcesPath, iconName);
|
||||||
? join(process.resourcesPath, 'icon.icns')
|
|
||||||
: join(process.resourcesPath, 'icon.ico'))
|
|
||||||
|
|
||||||
const win = new BrowserWindow({
|
const win = new BrowserWindow({
|
||||||
width: 1400,
|
width: 1400,
|
||||||
@@ -2534,12 +2540,20 @@ app.whenReady().then(async () => {
|
|||||||
updateSplashProgress(30, '正在加载界面...')
|
updateSplashProgress(30, '正在加载界面...')
|
||||||
mainWindow = createWindow({ autoShow: false })
|
mainWindow = createWindow({ autoShow: false })
|
||||||
|
|
||||||
// 初始化系统托盘图标(与其他窗口 icon 路径逻辑保持一致)
|
let iconName = 'icon.ico';
|
||||||
const resolvedTrayIcon = process.platform === 'win32'
|
if (process.platform === 'linux') {
|
||||||
? join(__dirname, '../public/icon.ico')
|
iconName = 'icon.png';
|
||||||
: (process.platform === 'darwin'
|
} else if (process.platform === 'darwin') {
|
||||||
? join(process.resourcesPath, 'icon.icns')
|
iconName = 'icon.icns';
|
||||||
: join(process.resourcesPath, 'icon.ico'))
|
}
|
||||||
|
|
||||||
|
const isDev = !!process.env.VITE_DEV_SERVER_URL
|
||||||
|
|
||||||
|
const resolvedTrayIcon = isDev
|
||||||
|
? join(__dirname, `../public/${iconName}`)
|
||||||
|
: join(process.resourcesPath, iconName);
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
tray = new Tray(resolvedTrayIcon)
|
tray = new Tray(resolvedTrayIcon)
|
||||||
tray.setToolTip('WeFlow')
|
tray.setToolTip('WeFlow')
|
||||||
|
|||||||
BIN
public/icon.png
Normal file
BIN
public/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
Reference in New Issue
Block a user