ื“ืœื’ ืœืชื•ื›ืŸ ื”ืจืืฉื™

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โ€‹

Common IPC Channelsโ€‹

ChannelDirectionDescription
timer:startRenderer โ†’ MainStart timer
timer:stopRenderer โ†’ MainStop timer
timer:statusMain โ†’ RendererTimer state update
screenshot:takenMain โ†’ RendererScreenshot captured
settings:updateBothSettings changed
app:minimizeRenderer โ†’ MainMinimize 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 });
});