nativeDesktopApp API provides a set of application-level IPC commands that allow web applications to interact with native Native Desktop features such as application control, history management, and app information.
- Application-related: Access and modify application-level details.
- Navigation-related: Control and retrieve navigation state within the app.
- Network-related: Manage network operations and monitor connectivity.
- Notification-related: Send notifications to the user from the Native Desktop app.
- Window-related: Get or set properties of the application window.
To safely use these APIs, always verify the runtime environment using
isInNativeDesktop() from @native-desktop/core.Custom IPCs
type TNativeDesktopPlugins = Record<string, any>; Represents a key–value map of custom plugin instances. Each key corresponds to a plugin name registered in the Native Desktop runtime, and each value exposes the plugin’s available methods or data.
You can access all available plugins through the nativeDesktopPlugins() function. It returns an object containing all registered plugin APIs.
fileManager that exposes methods like openFile() and saveFile().
Application-related IPCs
getAppUrl(): Promise<string>
Returns the URL of the current Native Desktop application.
quit(): void
Immediately closes the Native Desktop application.
restart(): void
Restarts the Native Desktop application.
Useful for applying configuration or environment changes.
getHistory(): Promise<{ url: string; title: string; timestamp: number }[]>
Retrieves the browsing history of the current Native Desktop app window.
filterHistory(filters: { url?: string; title?: string }): Promise<{ url: string; title: string; timestamp: number }[]>
Filters the application history based on a specific URL or title.
cleanHistory(): void
Clears all stored browsing history within the current Native Desktop application context.
Navigation-relates IPCs
canGoBack(): Promise<boolean>
Checks if there is a previous page in the navigation history.
canGoForward(): Promise<boolean>
Checks if there is a next page available in the navigation history.
goBack(): void
Navigates to the previous page in the current Native Desktop window’s history.
goForward(): void
Navigates forward to the next page in the Native Desktop app’s navigation history.
cloneWindow(): void
Creates a duplicate of the current Native Desktop application window, effectively cloning the app’s current state into a new window instance.
Network-related IPCs
getStatus(): Promise<{ online: boolean }>
Checks the current network connectivity state of the Native Desktop application.
onStatusChange(callback: (status: { online: boolean }) => void): void
Listens for changes in the network connectivity status. The provided callback is triggered whenever the connection goes online or offline.
speedTest(): Promise<any>
Performs a network speed test and returns performance metrics.
Notification-related IPCs
show(options: TNotificationOptions): void
Displays a native system notification. You can customize the title, body, icon, and add custom action buttons.
setBadge(count: number): void
Sets an application badge (e.g., dock or taskbar icon counter) to indicate unread messages, notifications, or pending tasks.
clear(): void
Clears all active notifications and resets the badge counter.
showAlert(options: TAlertOptions): Promise<void>
Displays a modal alert dialog with customizable title, message, and buttons.
showConfirm(options: TConfirmOptions): Promise<number>
Displays a confirmation dialog with multiple buttons and returns the index of the button the user clicked.
Window-related IPCs
minimize(): void
Minimizes the current Native Desktop application window.
maximize(): void
Maximizes the current Native Desktop window to full size.
unmaximize(): void
Restores the Native Desktop window to its previous (non-maximized) size.
close(): void
Closes the current Native Desktop window.
If it’s the main window, the application will likely quit.
toggleFullScreen(): void
Toggles the current window between fullscreen and windowed mode.
focus(): void
Brings the current Native Desktop window to the foreground and focuses it.
open(url?: string, config?: any): void
Opens a new Native Desktop window. You can optionally pass a URL and configuration object (for window options, size, etc.).
getBounds(): any
Retrieves the current window’s size and position. Returns an object similar to { x, y, width, height }.
setBounds(bounds: any): void
Sets or updates the window’s position and size.
isMaximized(callback: (event: any, state: boolean) => void): any
Registers a listener to detect changes in the window’s maximized state. The callback receives a state boolean (true = maximized, false = restored).