Built-in API Return Types
The electronAPI object extends the Window interface and provides a variety of methods for window actions, widget management, system information retrieval, and more. Here are the details of each method and their return types:
Method Descriptions
Window Actions
minimizeWindow: Minimizes the current window.
typescriptminimizeWindow: () => Promise<void>;closeWindow: Closes the current window.
typescriptcloseWindow: () => Promise<void>;
External Links
openExternal: Opens an external URL in the default web browser or a file in OS.
typescriptopenExternal: (url: string) => Promise<void>;
Widget Configuration
readWidgetsJson: Reads the widget configuration from
widgets.json.typescriptreadWidgetsJson: () => Promise<WidgetsConfig>;writeWidgetJson: Writes data to
widgets.json.typescriptwriteWidgetJson: (data: WidgetsConfig) => Promise<void>;
Widget Windows
createWidgetWindow: Creates a new window for a widget.
typescriptcreateWidgetWindow: (widgetKey: string) => Promise<void>;closeWidgetWindow: Closes a widget window.
typescriptcloseWidgetWindow: (widgetKey: string) => Promise<void>;
Disk Usage
getDiskUsage: Retrieves disk usage information.
typescriptgetDiskUsage: () => Promise<Drive[]>;
Widget Management
addWidget: Adds a new widget.
typescriptaddWidget: () => Promise<void>;removeWidget: Removes an existing widget by its key.
typescriptremoveWidget: (widgetKey: string) => Promise<void>;redownloadWidgetsFolder: Redownloads the widgets folder.
typescriptredownloadWidgetsFolder: () => Promise<void>;
System Information
getSystemInfo: Retrieves system information.
typescriptgetSystemInfo: () => Promise<Systeminformation.StaticData & Systeminformation.DynamicData>;
Widget Actions
reloadWidget: Reloads a widget by its key.
typescriptreloadWidget: (widgetKey: string) => Promise<void>;lockWidget: Locks a widget by its ID.
typescriptlockWidget: (widgetId: string) => Promise<void>;getLocation: Gets the current location.
typescriptgetLocation: () => Promise<void>;showNotification: Shows a notification with a title and optional body.
typescriptshowNotification: (title: string, body?: string) => Promise<void>;getRSSFeed: Fetches an RSS feed from a URL.
typescriptgetRSSFeed: (url: string) => Promise<RSSFeed>;opmlToJson: Converts OPML XML to JSON.
typescriptopmlToJson: (xml: string) => Promise<opmlToJsonResult>;showAllWidgets: Displays all widgets.
typescriptshowAllWidgets: () => Promise<void>;revealWidgetsFolder: Reveals the widgets folder in the file explorer.
typescriptrevealWidgetsFolder: () => Promise<void>;getAppVersion: Retrieves the application version.
typescriptgetAppVersion: () => Promise<string>;setLockAllWidgets: Locks or unlocks all widgets.
typescriptsetLockAllWidgets: (lock: boolean) => Promise<void>;setVisibilityAllWidgets: Sets the visibility of all widgets.
typescriptsetVisibilityAllWidgets: (visible: boolean) => Promise<void>;sortWidgets: Sorts the widgets.
typescriptsortWidgets: () => Promise<void>;setAlwaysOnTop: Sets whether a widget should always be on top.
typescriptsetAlwaysOnTop: (widgetId: string, alwaysOnTop: boolean) => Promise<void>;showWidget: Displays a specific widget by its ID.
typescriptshowWidget: (widgetId: string) => Promise<void>;
Custom Data Management
readCustomData: Reads custom data for a widget from a specified file path.
typescriptreadCustomData: (widgetKey: string, filePath: string) => Promise<string>;writeCustomData: Writes custom data for a widget to a specified file path.
typescriptwriteCustomData: ( widgetKey: string, filePath: string, data: CustomData, ) => Promise<void>;
By utilizing these methods, you can interact with various aspects of the application, from managing widget configurations to accessing system information, thus enhancing the functionality and customization of your application.