import { screen, type Display } from 'electron'; import type { DisplayInfo } from '../../shared/types/presentationSettings'; export function listDisplayInfos(): DisplayInfo[] { const primaryId = screen.getPrimaryDisplay().id; return screen.getAllDisplays().map((d) => displayToInfo(d, d.id === primaryId)); } function displayToInfo(display: Display, isPrimary: boolean): DisplayInfo { const label = display.label?.trim() || `Display ${String(display.id)}`; return { id: display.id, label, width: display.bounds.width, height: display.bounds.height, isPrimary, }; } export function resolvePresentationDisplay(displayId: number | null): Display { if (displayId != null) { const found = screen.getAllDisplays().find((d) => d.id === displayId); if (found) return found; } return screen.getPrimaryDisplay(); }