1
0

Add tray icon functionality for Auto-Git application

This commit is contained in:
2025-05-24 22:31:09 +02:00
parent 0ca0e9df36
commit 0c9a2452e3

29
main.js
View File

@@ -22,6 +22,35 @@ const store = new Store({
let tray = null;
function createTray(win) {
const iconPath = path.join(__dirname, 'assets/icon/trayicon.png');
const icon = nativeImage.createFromPath(iconPath);
// Standard-Größen je nach OS
let size;
switch (process.platform) {
case 'darwin': // macOS
size = { width: 22, height: 22 };
break;
case 'win32': // Windows
size = { width: 16, height: 16 };
break;
default: // Linux / other
size = { width: 24, height: 24 };
}
const trayImage = icon.resize(size);
const tray = new Tray(trayImage);
tray.setToolTip('Auto-Git läuft im Hintergrund');
tray.on('double-click', () => {
win.show();
win.focus();
});
return tray;
}
let folders = store.get('folders');
if (Array.isArray(folders)) {
folders = folders.map(f => ({