From e5ad9d0edbd845f1fca7348c2f8d5502c1b976f2 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Fri, 12 Sep 2025 22:44:01 +0200 Subject: [PATCH] Add platform-specific icon resolution and set app icons for Windows/Linux during development --- main.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 269db56..584d89d 100755 --- a/main.js +++ b/main.js @@ -15,6 +15,19 @@ const micromatch = require('micromatch'); const ignore = require('ignore'); let isQuiting = false; +// Resolve icon path for current platform (works in dev and packaged) +function resolveAppIconPath() { + const base = app.isPackaged ? process.resourcesPath : __dirname; + switch (process.platform) { + case 'darwin': + return path.join(base, 'assets', 'icon', 'mac', 'icon.icns'); + case 'win32': + return path.join(base, 'assets', 'icon', 'win', 'icon.ico'); + default: + return path.join(base, 'assets', 'icon', 'linux', 'icon.png'); + } +} + // Wenn wir gebündelt sind (= gepackte App), erweitern wir den PATH um die typischen Ollama-Verzeichnisse: if (app.isPackaged) { // Homebrew‐Pfad (M1/M2): /opt/homebrew/bin, bzw. /usr/local/bin @@ -114,6 +127,8 @@ function createWindow() { minWidth: 800, minHeight: 500, title: 'Auto-Git', + // Set icon so Windows/Linux show proper taskbar icon in dev + icon: resolveAppIconPath(), webPreferences: { preload: path.join(__dirname, 'preload.js'), contextIsolation: true @@ -1289,6 +1304,23 @@ async function autoCommit(folderPath, message, win) { app.whenReady().then(main); async function main() { + // On macOS, set dock icon during dev as well + if (process.platform === 'darwin') { + const iconPath = resolveAppIconPath(); + try { + const img = nativeImage.createFromPath(iconPath); + if (!img.isEmpty() && app.dock) { + app.dock.setIcon(img); + } + } catch (_) { /* ignore */ } + } + + // On Windows, set AppUserModelID so taskbar uses our icon/group + if (process.platform === 'win32') { + try { + app.setAppUserModelId('com.victorgiers.auto-git'); + } catch (_) { /* ignore */ } + } const win = createWindow(); @@ -2445,4 +2477,4 @@ ipcMain.on('get-selected-sync', (event) => { const folders = store.get('folders') || []; const selectedPath = store.get('selected'); event.returnValue = folders.find(f => f.path === selectedPath) || null; -}); \ No newline at end of file +});