feat: Implement core Discord clone functionality including Convex backend services for authentication, channels, messages, roles, and voice state, alongside new Electron frontend components for chat, voice, server settings, and user interface.
All checks were successful
Build and Release / build-and-release (push) Successful in 14m19s
All checks were successful
Build and Release / build-and-release (push) Successful in 14m19s
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const { app, BrowserWindow, ipcMain, shell, screen, safeStorage } = require('electron');
|
||||
const { app, BrowserWindow, ipcMain, shell, screen, safeStorage, powerMonitor } = require('electron');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
@@ -613,4 +613,22 @@ app.whenReady().then(async () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// AFK voice channel: expose system idle time to renderer
|
||||
ipcMain.handle('get-system-idle-time', () => powerMonitor.getSystemIdleTime());
|
||||
|
||||
// --- Auto-idle detection ---
|
||||
const IDLE_THRESHOLD_SECONDS = 300; // 5 minutes
|
||||
let wasIdle = false;
|
||||
setInterval(() => {
|
||||
if (!mainWindow || mainWindow.isDestroyed()) return;
|
||||
const idleTime = powerMonitor.getSystemIdleTime();
|
||||
if (!wasIdle && idleTime >= IDLE_THRESHOLD_SECONDS) {
|
||||
wasIdle = true;
|
||||
mainWindow.webContents.send('idle-state-changed', { isIdle: true });
|
||||
} else if (wasIdle && idleTime < IDLE_THRESHOLD_SECONDS) {
|
||||
wasIdle = false;
|
||||
mainWindow.webContents.send('idle-state-changed', { isIdle: false });
|
||||
}
|
||||
}, 15000);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user