Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

System APIs Overview

The perry/system module provides access to platform-native system features: preferences, secure storage, notifications, URL opening, dark mode detection, and app introspection.

import { openURL, isDarkMode, preferencesSet, preferencesGet, getAppIcon } from "perry/system";

Available APIs

FunctionDescriptionPlatforms
openURL(url)Open URL in default browser/appAll
isDarkMode()Check system dark modeAll
preferencesSet(key, value)Store a preferenceAll
preferencesGet(key)Read a preferenceAll
keychainSet(key, value)Secure storage writeAll
keychainGet(key)Secure storage readAll
sendNotification(title, body)Local notificationAll
clipboardGet()Read clipboardAll
clipboardSet(text)Write clipboardAll
audioStart()Start microphone captureAll
audioStop()Stop microphone captureAll
audioGetLevel()Current dB(A) sound levelAll
audioGetPeak()Current peak amplitude (0–1)All
audioGetWaveformSamples(n)Recent dB samples for visualizationAll
getLocale()Device language code (e.g. "de", "en")All
getDeviceModel()Device model identifierAll
getAppIcon(path)Get app/file icon as Image widgetmacOS, Linux

Quick Example

import { isDarkMode, preferencesGet, preferencesSet, openURL } from "perry/system";

// Detect dark mode
if (isDarkMode()) {
  console.log("Dark mode is active");
}

// Store user preferences
preferencesSet("theme", "dark");
const theme = preferencesGet("theme");

// Open a URL
openURL("https://example.com");

Next Steps