1
0

Add Electron IPC event handlers for tray menu interactions

This commit is contained in:
2025-05-24 21:39:35 +02:00
parent cf33222370
commit d91c87c470

View File

@@ -1,4 +1,4 @@
// renderer.js
const { ipcRenderer } = require('electron');
window.addEventListener('DOMContentLoaded', async () => {
// Elemente holen
@@ -486,4 +486,31 @@ folders.forEach(folderObj => {
inputCommitThreshold.value = num;
});
ipcRenderer.on('tray-toggle-monitoring', async (_e, folderPath) => {
const folders = await window.electronAPI.getFolders();
const folder = folders.find(f => f.path === folderPath);
if (folder) {
await window.electronAPI.setMonitoring(folder, !folder.monitoring);
}
});
ipcRenderer.on('tray-remove-folder', async (_e, folderPath) => {
const folders = await window.electronAPI.getFolders();
const folder = folders.find(f => f.path === folderPath);
if (folder) {
await window.electronAPI.removeFolder(folder);
// Optional: Feedback oder UI-Update
}
});
ipcRenderer.on('tray-add-folder', async () => {
await window.electronAPI.addFolder();
// Optional: Feedback/UI-Update
});
});