🖥️ Desktop Applications
Electron IPC Communication
Inter-process communication between Electron main and renderer processes.
Overview
The Gauzy desktop app uses Electron's IPC (Inter-Process Communication) for:
- Timer controls from renderer → main
- Screenshot capture from main → renderer
- Activity data collection
- Settings synchronization
Architecture
Diagram source
graph TB
subgraph Renderer Process
UI[Angular UI]
end
subgraph Main Process
IPC[IPC Handlers]
Timer[Timer Service]
Screenshot[Screenshot Service]
DB[Local Database]
end
UI -->|ipcRenderer.send| IPC
IPC -->|ipcMain.handle| Timer
IPC --> Screenshot
IPC --> DB
Timer -->|BrowserWindow.send| UICommon IPC Channels
| Channel | Direction | Description |
|---|---|---|
timer:start | Renderer → Main | Start timer |
timer:stop | Renderer → Main | Stop timer |
timer:status | Main → Renderer | Timer state update |
screenshot:taken | Main → Renderer | Screenshot captured |
settings:update | Both | Settings changed |
app:minimize | Renderer → Main | Minimize to tray |
Renderer → Main
// In Angular component/service
const { ipcRenderer } = window.require("electron");
ipcRenderer.send("timer:start", {
projectId: "uuid",
taskId: "uuid",
});
ipcRenderer.on("timer:status", (event, data) => {
// Update UI with timer state
});Main → Renderer
// In Electron main process
ipcMain.on("timer:start", (event, data) => {
timerService.start(data);
// Send status back
mainWindow.webContents.send("timer:status", { running: true });
});Related Pages
- Desktop Overview — desktop guide
- Desktop Server Mode — embedded server