Nnextop / app

window.desktop Typing

Provided globally by the package (index.d.ts):

interface Window {
desktop: {
fs?: {
readFile: (filePath: string) => Promise<string>
writeFile: (filePath: string, content: string) => Promise<boolean>
}
window?: {
minimize(): void
maximize(): void
close(): void
unmaximize(): void
isMaximized(): Promise<boolean>
}
menu?: {
menu: NextopAppMenuItem[]
setMenu: (newMenu: NextopAppMenuItem[]) => void
}
}
// also exposed by preload:
// nextop: { openExternal: (url: string) => void }
}

index.d.ts only types the three namespaced helpers above (fs, window, menu). Every other hook — useNotification, useClipboard, useShell, useSecureStore, useSocket (indirectly, via native WebSocket, no bridge at all), useDialog, useTray, useGlobalShortcut, useStore — goes through the untyped generic bridge window.desktop.ipcRenderer: { send, on, invoke } (also set up by preload.ts, allowlist-checked, but not declared in the global Window type). These hooks access it via (window as any).desktop.ipcRenderer rather than window.desktop.fs-style typed access. If you add a hook that needs a new channel, extend the allowlist in preload.ts (see the Security Model) — extending index.d.ts is optional/cosmetic, not required for it to work.