Enable monitoring toggle only if folder does not need relocation
This commit is contained in:
96
main.js
96
main.js
@@ -664,55 +664,61 @@ async function main() {
|
|||||||
const tray = createTray(win);
|
const tray = createTray(win);
|
||||||
|
|
||||||
// --- Context Menu bauen ---
|
// --- Context Menu bauen ---
|
||||||
function buildTrayMenu() {
|
function buildTrayMenu() {
|
||||||
const folders = store.get('folders') || [];
|
const folders = store.get('folders') || [];
|
||||||
const monitoringActive = folders.some(f => f.monitoring);
|
const monitoringActive = folders.some(f => f.monitoring);
|
||||||
|
|
||||||
return Menu.buildFromTemplate([
|
return Menu.buildFromTemplate([
|
||||||
{ label: 'Auto-Git öffnen', click: () => { win.show(); win.focus(); } },
|
{ label: 'Auto-Git öffnen', click: () => { win.show(); win.focus(); } },
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
...folders.map(f => ({
|
...folders.map(f => ({
|
||||||
label: `${f.monitoring ? '🟢' : '🔴'} ${path.basename(f.path)}`,
|
label: `${f.monitoring ? '🟢' : '🔴'} ${path.basename(f.path)}`,
|
||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: f.monitoring ? 'Monitoring stoppen' : 'Monitoring starten',
|
label: f.monitoring ? 'Monitoring stoppen' : 'Monitoring starten',
|
||||||
click: () => {
|
enabled: !f.needsRelocation, // <--- HIER!
|
||||||
win.webContents.send('tray-toggle-monitoring', f.path); // Renderer kann dann toggeln
|
click: () => {
|
||||||
}
|
if (!f.needsRelocation) {
|
||||||
},
|
win.webContents.send('tray-toggle-monitoring', f.path);
|
||||||
{
|
|
||||||
label: 'Ordner entfernen',
|
|
||||||
click: () => {
|
|
||||||
win.webContents.send('tray-remove-folder', f.path);
|
|
||||||
}
|
}
|
||||||
|
// Optional: Feedback anzeigen, falls doch geklickt wird.
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Ordner entfernen',
|
||||||
|
click: () => {
|
||||||
|
win.webContents.send('tray-remove-folder', f.path);
|
||||||
}
|
}
|
||||||
]
|
|
||||||
})),
|
|
||||||
{ type: 'separator' },
|
|
||||||
{
|
|
||||||
label: 'Neuen Ordner hinzufügen',
|
|
||||||
click: () => { win.webContents.send('tray-add-folder'); }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Alle Monitorings starten',
|
|
||||||
click: () => {
|
|
||||||
folders.forEach(f => {
|
|
||||||
if (!f.monitoring) win.webContents.send('tray-toggle-monitoring', f.path);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
]
|
||||||
{
|
})),
|
||||||
label: 'Alle Monitorings stoppen',
|
{ type: 'separator' },
|
||||||
click: () => {
|
{
|
||||||
folders.forEach(f => {
|
label: 'Neuen Ordner hinzufügen',
|
||||||
if (f.monitoring) win.webContents.send('tray-toggle-monitoring', f.path);
|
click: () => { win.webContents.send('tray-add-folder'); }
|
||||||
});
|
},
|
||||||
}
|
{
|
||||||
},
|
label: 'Alle Monitorings starten',
|
||||||
{ type: 'separator' },
|
click: () => {
|
||||||
{ label: 'Beenden', click: () => { isQuiting = true; app.quit(); } }
|
folders.forEach(f => {
|
||||||
]);
|
if (!f.monitoring && !f.needsRelocation) {
|
||||||
}
|
win.webContents.send('tray-toggle-monitoring', f.path);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Alle Monitorings stoppen',
|
||||||
|
click: () => {
|
||||||
|
folders.forEach(f => {
|
||||||
|
if (f.monitoring) win.webContents.send('tray-toggle-monitoring', f.path);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ label: 'Beenden', click: () => { isQuiting = true; app.quit(); } }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
tray.setToolTip('Auto-Git läuft im Hintergrund');
|
tray.setToolTip('Auto-Git läuft im Hintergrund');
|
||||||
tray.setContextMenu(buildTrayMenu());
|
tray.setContextMenu(buildTrayMenu());
|
||||||
|
|||||||
Reference in New Issue
Block a user