Skip to main content

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 });
});