Skip to main content

Overview

SuperCmd is built on Electron, leveraging a multi-process architecture that separates system operations (main process) from UI rendering (renderer process). This design provides security, stability, and native OS integration.
The main process code lives in src/main/, while renderer code is in src/renderer/. The two processes communicate via IPC (Inter-Process Communication) through a secure preload script.

Process Architecture

Main Process

The main process (src/main/main.ts) handles:

Window Management

Creating, showing, hiding, and positioning windows with native glass effects

System Integration

Global shortcuts, menu bar, system tray, and macOS-specific features

File System

All file I/O operations, including extension installation and script execution

Native Modules

Swift binaries for speech recognition, window management, and input monitoring

Initialization Flow

Renderer Process

The renderer process (src/renderer/src/) is a React application that:
  • Renders the launcher UI and extension views
  • Manages application state with React hooks
  • Communicates with main process via IPC
  • Executes extension code in isolated contexts

Application Structure

Preload Script

The preload script (src/main/preload.ts) creates a secure IPC bridge:

Window Management

Launcher Window

The main launcher window uses native glass effects on macOS:

Detached Windows

SuperCmd supports detached popup windows for features like Whisper (dictation) and Speak (TTS):

IPC Communication

Request/Response Pattern

Most IPC follows a simple request/response pattern:

Event Streaming

For long-running operations like AI streaming, SuperCmd uses event-based communication:

Global Shortcuts

SuperCmd registers global keyboard shortcuts using Electron’s globalShortcut API:

Per-Command Hotkeys

Individual commands can register their own shortcuts:

Window Manager Worker

For advanced window management, SuperCmd uses a forked Node.js worker process:

Worker Architecture

Worker Operations

Native Protocol

SuperCmd registers a custom sc-asset:// protocol for loading extension assets:
Extensions reference assets like:

Settings Management

Settings are persisted as JSON and cached in memory:

Performance Optimizations

Window Pooling

Reuse hidden windows instead of creating new ones for better performance

IPC Batching

Group related IPC calls to reduce round-trips

Worker Processes

Offload expensive operations to separate processes

Lazy Loading

Load extension code only when needed

Blur-Hide Debouncing

To prevent accidental hiding during file dialogs:

See Also

Extension Runtime

How extensions are bundled and executed

Raycast API

Complete API compatibility reference

Native Modules

Swift integration for macOS features