Native API

Control Everything

Full access to system-level APIs for controlling windows, files, network, media, and more. All APIs are exposed through a simple IPC interface accessible from both frontend and AI commands.

50+

APIs APIs

9

System APIs

9

Window APIs

9

Files APIs

Available APIs

API Categories

System APIs

Control system-level functions like displays, power, and system preferences.

getSystemInfo()SystemInfo

Get CPU, memory, disk info

getDisplays()Display[]

List all connected displays

setDisplayMode()void

Change resolution, refresh rate

getSystemPreferences()Preferences

Get macOS system preferences

setSystemPreference()void

Update system preferences

lockScreen()void

Lock the computer

sleep()void

Put display to sleep

restart()void

Restart the system

shutdown()void

Shut down the system

Implementation

Code Examples

Example

Reference

Type Definitions

TypeScript Definitions

// Type definitions for all Native APIs

interface SystemInfo {
  platform: 'darwin' | 'windows' | 'linux';
  arch: string;
  version: string;
  cpu: { model: string; cores: number; speed: number };
  memory: { total: number; free: number };
  disk: { total: number; free: number };
  uptime: number;
}

interface Display {
  id: number;
  name: string;
  bounds: { x: number; y: number; width: number; height: number };
  isPrimary: boolean;
  scaleFactor: number;
}

interface Window {
  id: string;
  title: string;
  app: AppInfo;
  bounds: { x: number; y: number; width: number; height: number };
  isMinimized: boolean;
  isMaximized: boolean;
}

interface AppInfo {
  name: string;
  bundleId: string;
  pid: number;
  icon?: string;
}

interface Point {
  x: number;
  y: number;
}

interface FileInfo {
  name: string;
  path: string;
  isDirectory: boolean;
  size: number;
  modifiedAt: Date;
}

interface NetworkStatus {
  connected: boolean;
  type: 'wifi' | 'ethernet' | 'cellular' | 'none';
  strength?: number;
}

interface HttpResponse {
  status: number;
  data: any;
  headers: Record<string, string>;
}

// API Methods

// System
invoke('get-system-info'): Promise<SystemInfo>
invoke('get-displays'): Promise<Display[]>
invoke('set-display-mode', { displayId, width, height, refreshRate }): Promise<void>
invoke('get-system-preferences'): Promise<Preferences>
invoke('set-system-preference', { key, value }): Promise<void>
invoke('lock-screen'): Promise<void>
invoke('sleep'): Promise<void>
invoke('restart'): Promise<void>
invoke('shutdown'): Promise<void>

// Window
invoke('get-windows'): Promise<Window[]>
invoke('focus-window', { windowId }): Promise<void>
invoke('set-window-bounds', { windowId, x, y, width, height }): Promise<void>
invoke('minimize-window', { windowId }): Promise<void>
invoke('maximize-window', { windowId }): Promise<void>
invoke('close-window', { windowId }): Promise<void>
invoke('set-window-always-on-top', { windowId, alwaysOnTop }): Promise<void>

// Input
invoke('type-text', { text }): Promise<void>
invoke('press-key', { key }): Promise<void>
invoke('press-hot-key', { modifiers, key }): Promise<void>
invoke('move-mouse', { x, y }): Promise<void>
invoke('click-mouse', { button, x?, y? }): Promise<void>
invoke('scroll-mouse', { deltaX, deltaY }): Promise<void>
invoke('drag-mouse', { fromX, fromY, toX, toY }): Promise<void>
invoke('get-mouse-position'): Promise<Point>
invoke('get-active-app'): Promise<AppInfo>

// Files
invoke('read-file', { path, encoding? }): Promise<string | Buffer>
invoke('write-file', { path, content, encoding? }): Promise<void>
invoke('append-file', { path, content }): Promise<void>
invoke('delete-file', { path }): Promise<void>
invoke('move-file', { source, destination }): Promise<void>
invoke('copy-file', { source, destination }): Promise<void>
invoke('list-directory', { path }): Promise<FileInfo[]>
invoke('create-directory', { path }): Promise<void>
invoke('get-file-info', { path }): Promise<FileInfo>

// Network
invoke('http-request', { method, url, headers?, body?, timeout? }): Promise<HttpResponse>
invoke('download-file', { url, destination, filename? }): Promise<string>
invoke('open-url', { url }): Promise<void>
invoke('get-local-ip'): Promise<string>
invoke('ping', { host }): Promise<number>
invoke('get-network-status'): Promise<NetworkStatus>

// Media
invoke('set-volume', { level }): Promise<void>
invoke('get-volume'): Promise<number>
invoke('mute-audio', { muted }): Promise<void>
invoke('play-pause-media'): Promise<void>
invoke('next-track'): Promise<void>
invoke('prev-track'): Promise<void>
invoke('screenshot', { x?, y?, width?, height?, format?, quality? }): Promise<string>

Best Practices

Usage Patterns

Recommended

  • Always await async operations before continuing
  • Use error handling for file/network operations
  • Check permissions before destructive actions
  • Add delays between rapid input operations

Avoid

  • Rapid-fire keyboard input without delays
  • Deleting files without confirmation
  • Ignoring errors on system operations
  • Running shutdown without user consent

Ready to Build?

Use these APIs directly from the AI chat or in your custom commands and automations.

Edit on GitHub