feat(editor): настройки экрана презентации при запуске сессии
Выбор монитора и полноэкранного режима в настройках; при «Запустить» окно презентации открывается на выбранном дисплее автоматически. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
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();
|
||||
}
|
||||
Reference in New Issue
Block a user