import { BrowserWindow } from 'electron'; import type { MainEventMap } from '../../main-events'; function getActiveWindows() { return BrowserWindow.getAllWindows().filter(win => !win.isDestroyed()); } export function sendMainEvent( type: T, ...args: Parameters ) { getActiveWindows().forEach(win => win.webContents.send(type, ...args)); }