// Renderer-side wrapper for the OS-level window fullscreen flag. Replaces // the Tauri call `getCurrentWindow().setFullscreen(...)` from // `@tauri-apps/api/window`. We route through the Electron preload bridge // to `BrowserWindow.setFullScreen()` in the main process so the Windows // taskbar / macOS menubar stay covered while in cinema mode. // // Mirrors the shape of `lib/autoStart.ts` — runtime guard against the // Electron preload marker, swallow errors so renderer logic never breaks // when the host is not the desktop app (e.g. web build / Storybook). import { isTauriRuntime } from './globalShortcut'; export async function setWindowFullscreen(enabled: boolean): Promise { if (!isTauriRuntime()) return; try { await window.electronAPI.setFullscreen(enabled); } catch (err: unknown) { // setFullscreen can reject if the window is minimised or focus is // gone — both recoverable noise, matches the Tauri callsite which // also `.catch(() => undefined)`s the promise. console.warn('setWindowFullscreen failed', err); } }