// Window fullscreen adapter — replaces Tauri's // `getCurrentWindow().setFullscreen(...)` from `@tauri-apps/api/window`. // The renderer asks main to flip the OS-level fullscreen flag on the host // BrowserWindow so cinema mode covers the Windows taskbar / macOS menubar // the way Tauri's appWindow.setFullscreen used to. import { BrowserWindow, ipcMain } from 'electron'; import { CHANNELS } from '../ipc-types'; export function register(mainWindow: BrowserWindow): void { ipcMain.handle(CHANNELS.WINDOW_SET_FULLSCREEN, (evt, enabled: boolean) => { try { // Prefer the BrowserWindow that issued the IPC so multi-window setups // affect the right host; fall back to the main window we were // registered against (matches autostart.ts's app-singleton shape). const win = BrowserWindow.fromWebContents(evt.sender) ?? mainWindow; if (!win || win.isDestroyed()) return; win.setFullScreen(!!enabled); } catch (err: unknown) { console.warn('window setFullscreen failed', err); throw err; } }); }