icon for the system tray wasn't being found correctly for packaged releases

This commit is contained in:
lone-cloud 2025-10-01 12:32:38 -07:00
parent 00411d8cdc
commit a92cf71bd7
2 changed files with 11 additions and 8 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "gerbil", "name": "gerbil",
"productName": "Gerbil", "productName": "Gerbil",
"version": "1.6.2", "version": "1.6.3",
"description": "Run Large Language Models locally", "description": "Run Large Language Models locally",
"main": "out/main/index.js", "main": "out/main/index.js",
"homepage": "./", "homepage": "./",
@ -109,6 +109,12 @@
"to": "assets/kcpp_sdui.embd" "to": "assets/kcpp_sdui.embd"
} }
], ],
"extraResources": [
{
"from": "src/assets/icon.png",
"to": "icon.png"
}
],
"mac": { "mac": {
"compression": "maximum", "compression": "maximum",
"category": "public.app-category.productivity", "category": "public.app-category.productivity",

View file

@ -6,7 +6,7 @@ import {
MenuItemConstructorOptions, MenuItemConstructorOptions,
} from 'electron'; } from 'electron';
import { join } from 'path'; import { join } from 'path';
import { resourcesPath, platform } from 'process'; import { platform, resourcesPath } from 'process';
import { getEnableSystemTray } from './config'; import { getEnableSystemTray } from './config';
import { getMainWindow } from './window'; import { getMainWindow } from './window';
import type { CpuMetrics, MemoryMetrics, GpuMetrics } from './monitoring'; import type { CpuMetrics, MemoryMetrics, GpuMetrics } from './monitoring';
@ -184,12 +184,9 @@ export function createTray() {
return; return;
} }
let iconPath: string; const iconPath = app.isPackaged
if (app.isPackaged) { ? join(resourcesPath, 'icon.png')
iconPath = join(resourcesPath, 'assets', 'icon.png'); : join(__dirname, '../../src/assets/icon.png');
} else {
iconPath = join(__dirname, '../../src/assets/icon.png');
}
const icon = nativeImage.createFromPath(iconPath); const icon = nativeImage.createFromPath(iconPath);