From 5bb06c4904db9d88caf36ce502ce067273c4b997 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Wed, 20 May 2026 18:16:43 -0400 Subject: [PATCH] feat(display): expose list_display_modes and set_display_mode in relay Svelte callers can now enumerate all display modes and set resolution/ refresh/HiDPI per display through the native bridge. --- src/lib/electron/electron_relay.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/lib/electron/electron_relay.ts b/src/lib/electron/electron_relay.ts index b957c8f3..ac0a511d 100644 --- a/src/lib/electron/electron_relay.ts +++ b/src/lib/electron/electron_relay.ts @@ -503,6 +503,30 @@ export async function set_display_layout({ return await native.set_display_layout({ mode, configStr }); } +export async function list_display_modes() { + if (!native || !native.list_display_modes) + return { success: false, error: 'Native handler list_display_modes not available' }; + return await native.list_display_modes(); +} + +export async function set_display_mode({ + display_index, + width, + height, + refresh_rate, + hidpi +}: { + display_index: number; + width: number; + height: number; + refresh_rate?: number; + hidpi?: boolean | null; +}) { + if (!native || !native.set_display_mode) + return { success: false, error: 'Native handler set_display_mode not available' }; + return await native.set_display_mode({ display_index, width, height, refresh_rate, hidpi }); +} + export async function power_control({ action }: {