fix(gui): resolve GNOME taskbar icon via WM_CLASS/StartupWMClass match

Window/taskbar icon never showed because the packaged .desktop had
StartupWMClass=ModelRouter while the live window WM_CLASS is the lowercase
app class 'modelrouter-gui' — no match, so GNOME fell back to the default
Electron icon.

- main.js: set BrowserWindow icon asset + backgroundColor (window paints
  correctly with frameless titlebar and provides the taskbar's default icon)
- package.json: build.linux.desktop.entry.StartupWMClass now equals the real
  WM_CLASS so packaged installs match too
- local integration: user-level .desktop installed at
  ~/.local/share/applications/modelrouter-gui.desktop (points at the unpacked
  binary) so GNOME resolves the icon immediately
This commit is contained in:
2026-08-17 10:33:10 +08:00
parent d75d8411c0
commit 23bd9e5552
2 changed files with 11 additions and 1 deletions

View File

@ -497,6 +497,11 @@ function createWindow() {
const menu = Menu.buildFromTemplate([]);
Menu.setApplicationMenu(menu);
mainWindow = new BrowserWindow({
// Window icon (taskbar/dock): same asset as the tray and package.
icon: path.join(__dirname, "build", "icon.png"),
// GNOME taskbar icons match the window's WM_CLASS (lowercase
// "modelrouter-gui") against StartupWMClass in the .desktop file.
backgroundColor: "#1f2937",
width: 1280,
height: 860,
minWidth: 900,

View File

@ -22,7 +22,7 @@
"build": {
"appId": "com.modelrouter.gui",
"productName": "ModelRouter",
"linux": {
"linux": {
"target": [
"deb",
"rpm",
@ -32,6 +32,11 @@
"icon": "build/icon.png",
"maintainer": "ModelRouter",
"synopsis": "ModelRouter Desktop",
"desktop": {
"entry": {
"StartupWMClass": "modelrouter-gui"
}
},
"extraResources": [
{
"from": "bin/llmsproxy",