1
0

auto-git:

[change] main.js
This commit is contained in:
2025-06-01 09:43:13 +02:00
parent 1f8fee03fd
commit deb3109f91

49
main.js
View File

@@ -8,15 +8,26 @@ const { spawnSync } = require('child_process');
const path = require('path');
const fs = require('fs');
const os = require('os');
const Store = require('electron-store');
const simpleGit = require('simple-git');
const chokidar = require('chokidar');
const micromatch = require('micromatch');
const ignore = require('ignore');
const store = require('./modules/store');
const store = new Store({
defaults: {
folders: [],
selected: null,
skymode: true,
skipGitPrompt: true,
intelligentCommitThreshold: 20,
minutesCommitThreshold: 5,
autostart: false,
closeToTray: true,
needsRelocation: false,
dailyCommitStats: {}
}
});
let folders = store.get('folders') || [];
folders = folders.map(f => ({
@@ -26,13 +37,39 @@ folders = folders.map(f => ({
store.set('folders', folders);
console.log("Startup-Folders:", store.get('folders'));
let tray = null;
let isQuiting = false;
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;
}
if (Array.isArray(folders)) {
folders = folders.map(f => ({