fix: use absolute icon path and place icon outside asar on Linux

The hicolor icon theme index only lists sizes up to 512x512, so an icon
installed only at 1024x1024 is invisible to GNOME/KDE's theme resolver,
causing both the app launcher and taskbar to show a generic icon.
Additionally, BrowserWindow.icon cannot be read by the window manager
when the file is inside app.asar.

- extraResources: copy logo_larger.png to resources/ (outside asar) so
  it lands at /opt/Automaker/resources/logo_larger.png on install
- linux.desktop.Icon: set to the absolute resources path, bypassing the
  hicolor theme lookup and its size constraints entirely
- icon-manager.ts: on Linux production use process.resourcesPath so
  BrowserWindow receives a real filesystem path the WM can read directly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
DhanushSantosh
2026-02-26 17:49:26 +05:30
parent 70c9fd77f6
commit 82e9396cb8
2 changed files with 20 additions and 8 deletions

View File

@@ -202,6 +202,10 @@
"filter": [
"**/*"
]
},
{
"from": "public/logo_larger.png",
"to": "logo_larger.png"
}
],
"mac": {
@@ -261,7 +265,10 @@
"maintainer": "webdevcody@gmail.com",
"executableName": "automaker",
"description": "An autonomous AI development studio that helps you build software faster using AI-powered agents",
"synopsis": "AI-powered autonomous development studio"
"synopsis": "AI-powered autonomous development studio",
"desktop": {
"Icon": "/opt/Automaker/resources/logo_larger.png"
}
},
"rpm": {
"depends": [

View File

@@ -21,18 +21,23 @@ export function getIconPath(): string | null {
let iconFile: string;
if (process.platform === 'win32') {
iconFile = 'icon.ico';
} else if (process.platform === 'darwin') {
iconFile = 'logo_larger.png';
} else {
iconFile = 'logo_larger.png';
}
// __dirname is apps/ui/dist-electron (Vite bundles all into single file)
// In production the asar layout is: /dist-electron/main.js and /dist/logo_larger.png
// Vite copies public/ assets to the root of dist/, NOT dist/public/
const iconPath = isDev
? path.join(__dirname, '../public', iconFile)
: path.join(__dirname, '../dist', iconFile);
let iconPath: string;
if (isDev) {
iconPath = path.join(__dirname, '../public', iconFile);
} else if (process.platform === 'linux') {
// On Linux, use the icon copied to resourcesPath via extraResources.
// This places it outside app.asar so the window manager can read it
// directly, and matches the absolute path used in the .desktop entry.
iconPath = path.join(process.resourcesPath, iconFile);
} else {
// macOS / Windows: icon is inside the asar; Electron handles it natively.
iconPath = path.join(__dirname, '../dist', iconFile);
}
try {
if (!electronAppExists(iconPath)) {