feat(x): add Caffeinate toggle to keep the system awake

Adds a Caffeinate switch (Settings → Mobile channels) that uses
Electron's powerSaveBlocker ('prevent-app-suspension', equivalent to
caffeinate -i) to stop the machine from idle-sleeping so the
WhatsApp/Telegram bridge stays connected. While active, an amber
coffee icon in the titlebar shows the state and can be clicked to
turn it off; a power:caffeinateChanged push keeps the titlebar
indicator and the settings switch in sync.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Arjun 2026-07-08 00:07:14 +05:30
parent 678130ab40
commit 94727a238b
5 changed files with 145 additions and 3 deletions

View file

@ -1004,6 +1004,20 @@ const ipcSchemas = {
success: z.literal(true),
}),
},
// ── Caffeinate (keep system awake, like macOS `caffeinate`) ──
'power:getCaffeinate': {
req: z.null(),
res: z.object({ enabled: z.boolean() }),
},
'power:setCaffeinate': {
req: z.object({ enabled: z.boolean() }),
res: z.object({ enabled: z.boolean() }),
},
// Push: main → renderer when caffeinate state changes, so indicators stay live.
'power:caffeinateChanged': {
req: z.object({ enabled: z.boolean() }),
res: z.null(),
},
// ── Mobile channels (WhatsApp / Telegram bridge) ─────────────
'channels:getConfig': {
req: z.null(),