diff --git a/build/icon.icns b/build/icon.icns index 28644aa..45fcd22 100644 Binary files a/build/icon.icns and b/build/icon.icns differ diff --git a/build/icon.ico b/build/icon.ico index 72c391e..d7ad033 100644 Binary files a/build/icon.ico and b/build/icon.ico differ diff --git a/build/icon.png b/build/icon.png index cf9e8b2..f607179 100644 Binary files a/build/icon.png and b/build/icon.png differ diff --git a/electron-builder.yml b/electron-builder.yml index bc5ba91..04b427c 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -25,6 +25,7 @@ extraResources: filter: - '**/*' win: + icon: icon.ico # WCDB's Windows runtime checks the host executable name. The dev runtime is # electron.exe, so keep the packaged executable compatible while preserving # WechatExplorer as the product/shortcut name. @@ -37,6 +38,7 @@ nsis: uninstallDisplayName: ${productName} createDesktopShortcut: always mac: + icon: icon.icns entitlementsInherit: build/entitlements.mac.plist extendInfo: # The bundled WCDB bridge accepts Electron as its internal host name. The @@ -51,6 +53,7 @@ mac: dmg: artifactName: ${name}-${version}-${arch}.${ext} linux: + icon: icon.png target: - AppImage - snap diff --git a/resources/icon.png b/resources/icon.png index cf9e8b2..f607179 100644 Binary files a/resources/icon.png and b/resources/icon.png differ diff --git a/src/main/index.ts b/src/main/index.ts index 214180a..8965673 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -11,6 +11,7 @@ import { dialog } from 'electron' import { join } from 'path' +import { existsSync } from 'fs' import { electronApp, optimizer, is } from '@electron-toolkit/utils' import icon from '../../resources/icon.png?asset' import { WechatDb } from './wechat-db' @@ -75,6 +76,9 @@ const keyServiceMac = new KeyServiceMac() const keyServiceWin = new KeyServiceWin() let tray: Tray | null = null +const packagedIconPath = join(process.resourcesPath, 'resources', 'icon.png') +const appIconPath = existsSync(packagedIconPath) ? packagedIconPath : icon + // WCDB's Windows runtime checks the host application name during wcdb_init. // Mirroring WeFlow's name unblocks the -1006 init failure on Windows. app.setName(process.platform === 'win32' ? 'WeFlow' : 'WechatExplorer') @@ -99,7 +103,7 @@ function createWindow(): void { height: 800, show: false, autoHideMenuBar: true, - ...(process.platform === 'linux' ? { icon } : {}), + icon: appIconPath, webPreferences: { preload: join(__dirname, '../preload/index.js'), sandbox: false @@ -140,7 +144,9 @@ app.whenReady().then(async () => { } // 涓虹獥鍙h缃簲鐢ㄧ▼搴忕敤鎴锋ā鍨?ID - electronApp.setAppUserModelId('com.electron') + electronApp.setAppUserModelId('com.wechatexplorer.app') + + if (process.platform === 'darwin') app.dock?.setIcon(appIconPath) // 鍦ㄥ紑鍙戠幆澧冧腑榛樿鎸?F12 鎵撳紑鎴栧叧闂?DevTools // 鍦ㄧ敓浜х幆澧冧腑蹇界暐 CommandOrControl + R @@ -674,8 +680,12 @@ function buildTrayMenu(): Menu { function setupTray(): void { if (tray) return try { - const image = nativeImage.createFromPath(join(__dirname, '../../resources/icon.png')) - tray = new Tray(image.isEmpty() ? nativeImage.createEmpty() : image) + const image = nativeImage.createFromPath(appIconPath) + const traySize = process.platform === 'darwin' ? 20 : 24 + const trayImage = image.isEmpty() + ? nativeImage.createEmpty() + : image.resize({ width: traySize, height: traySize, quality: 'best' }) + tray = new Tray(trayImage) tray.setToolTip('WechatExplorer') tray.setContextMenu(buildTrayMenu()) tray.on('click', () => showMainWindow()) diff --git a/src/renderer/index.html b/src/renderer/index.html index fd18c64..8bf886e 100644 --- a/src/renderer/index.html +++ b/src/renderer/index.html @@ -2,7 +2,8 @@ - Electron + WechatExplorer + + + + + + + + diff --git a/src/renderer/src/assets/main.css b/src/renderer/src/assets/main.css index aa00fec..12bdb32 100644 --- a/src/renderer/src/assets/main.css +++ b/src/renderer/src/assets/main.css @@ -59,27 +59,16 @@ body { display: grid; place-items: center; border: 0; - border-radius: var(--wxex-radius-md); - background: var(--wxex-brand); - color: #ffffff; + border-radius: 12px; + background: transparent; -webkit-app-region: no-drag; } -.app-brand svg { - width: 34px; - height: 34px; -} - -.app-brand path { - fill: none; - stroke: currentColor; - stroke-width: 1.8; - stroke-linecap: round; - stroke-linejoin: round; -} - -.app-brand circle { - fill: currentColor; +.app-brand img { + display: block; + width: 42px; + height: 42px; + border-radius: 12px; } .primary-navigation { diff --git a/src/renderer/src/components/layout/AppShell.tsx b/src/renderer/src/components/layout/AppShell.tsx index 65b8499..96aa04e 100644 --- a/src/renderer/src/components/layout/AppShell.tsx +++ b/src/renderer/src/components/layout/AppShell.tsx @@ -2,6 +2,7 @@ import React from 'react' import { AccountSummary } from '../account/AccountSummary' import { PrimaryNavigation } from './PrimaryNavigation' import { AppPage, PRIMARY_NAV_ITEMS } from './navigation' +import brandIcon from '../../assets/brand-icon.svg' interface SelfInfo { wxid: string @@ -22,18 +23,7 @@ interface AppShellProps { function BrandLogo(): React.ReactElement { return (
- +
) }