feat(desktop): add automatic game/app activity detection

Add cross-platform process scanning that detects running games and apps,
then broadcasts them as Rich Presence activities via the existing Phase 1
pipeline (activityStore -> WS -> other users).

- games.json dictionary with 26 entries (games, Spotify, VLC, OBS)
- activityDetector module: polls OS process list every 15s via execFile,
  matches against dictionary, emits IPC on state change only
- IPC bridge in main.ts/preload.ts with cleanup on quit
- Frontend activityBridge subscribes to IPC and feeds activityStore
- Supports Windows (tasklist CSV), macOS (ps -c), Linux (ps)
This commit is contained in:
Jannis Braun
2026-03-21 02:57:30 +01:00
parent 568b049b22
commit 0f4f129337
7 changed files with 321 additions and 0 deletions
+8
View File
@@ -68,4 +68,12 @@ contextBridge.exposeInMainWorld('backspace', {
getAutoLaunchSettings: () => ipcRenderer.invoke('get-auto-launch-settings'),
setAutoLaunchSettings: (settings: { openAtLogin?: boolean; startMinimized?: boolean }) =>
ipcRenderer.invoke('set-auto-launch-settings', settings),
// Activity detection (game/app process scanning)
onActivityDetected: (callback: (activity: unknown) => void) => {
const handler = (_event: Electron.IpcRendererEvent, activity: unknown) => callback(activity);
ipcRenderer.on('activity-detected', handler);
return () => { ipcRenderer.removeListener('activity-detected', handler); };
},
getCurrentActivity: () => ipcRenderer.invoke('get-current-activity'),
});