OpenSuperWhisper Configuration Options in AppPreferences.swift: Complete Reference Guide

OpenSuperWhisper stores all user-tunable settings in AppPreferences.swift using a singleton AppPreferences class that wraps UserDefaults with custom property wrappers, exposing 21 configuration options ranging from transcription language to hotkey behavior.

OpenSuperWhisper, an open-source voice transcription application for macOS and iOS, centralizes its persistent user preferences in OpenSuperWhisper/Utils/AppPreferences.swift. This Swift file defines the AppPreferences class—a thread-safe singleton accessed via AppPreferences.shared—that abstracts the underlying UserDefaults system with compile-time type safety. Understanding these configuration options enables developers to programmatically customize transcription engines, decoding parameters, and automation workflows.

Architecture of AppPreferences.swift

The AppPreferences class implements the singleton pattern to guarantee a single source of truth across the application lifecycle. Rather than accessing UserDefaults directly, the architecture relies on two custom property wrappers defined in the same file:

  • @UserDefault: Persists non-optional values (String, Bool, Double, Int) and guarantees a default value when no data exists
  • @OptionalUserDefault: Persists optional values (String?, Data?) that may legitimately be nil

On first initialization, the class executes migrateOldPreferences() (lines 30-35) to ensure backward compatibility. This routine automatically migrates the legacy selectedModelPath key to the current selectedWhisperModelPath key, preserving user settings across app updates.

Available Configuration Options in AppPreferences.swift

The file exposes 21 distinct configuration options organized by functional responsibility:

Model and Engine Settings

Control which transcription backend and model files OpenSuperWhisper utilizes:

Language and Output Behavior

Configure language detection, translation, and text formatting:

Decoding Parameters

Advanced settings controlling the Whisper inference process:

Automation and Clipboard

System integration options for workflow automation:

Hotkey and Input Configuration

Hardware interaction and accessibility settings:

Application State

Accessing Configuration Options Programmatically

All UI components and services interact with AppPreferences.shared rather than UserDefaults directly. This abstraction provides compile-time type safety and instant persistence.

Reading values:

import OpenSuperWhisper

// Access the current transcription engine
let engine = AppPreferences.shared.selectedEngine

// Safely unwrap optional model path
if let modelPath = AppPreferences.shared.selectedWhisperModelPath {
    print("Loading model from: \(modelPath)")
}

// Check automation settings
let shouldAutoPaste = AppPreferences.shared.autoPasteTranscription

Modifying configuration options:

// Change transcription language to Japanese
AppPreferences.shared.whisperLanguage = "ja"

// Enable beam search for better accuracy
AppPreferences.shared.useBeamSearch = true
AppPreferences.shared.beamSize = 10

// Disable automatic pasting
AppPreferences.shared.autoPasteTranscription = false

The property wrappers persist changes immediately to UserDefaults, and the UI layer in Settings.swift reflects these updates without requiring manual synchronization.

Summary

  • OpenSuperWhisper centralizes user configuration in OpenSuperWhisper/Utils/AppPreferences.swift via the AppPreferences singleton.
  • 21 configuration options cover model selection (selectedWhisperModelPath), transcription behavior (whisperLanguage, translateToEnglish), decoding parameters (temperature, beamSize), and workflow automation (autoCopyToClipboard, autoPasteTranscription).
  • Type-safe persistence is achieved through custom @UserDefault and @OptionalUserDefault wrappers that eliminate boilerplate nil-checking.
  • Migration logic in migrateOldPreferences() (lines 30-35) ensures backward compatibility by automatically upgrading legacy preference keys.
  • Separation of concerns is maintained by having Settings.swift serve as the exclusive UI layer for reading and writing these values.

Frequently Asked Questions

How do I reset all OpenSuperWhisper configuration options to their defaults?

OpenSuperWhisper does not expose a bulk reset API in AppPreferences.swift. To reset preferences programmatically, iterate through the specific keys listed above and remove them from UserDefaults.standard, or manually set each property on AppPreferences.shared back to its documented default value. For a complete reset, users can delete the app's preferences plist from ~/Library/Preferences/ or use the terminal command defaults delete com.starmel.OpenSuperWhisper.

What is the difference between @UserDefault and @OptionalUserDefault in AppPreferences.swift?

The @UserDefault wrapper enforces non-optional types with mandatory default values, ensuring that properties like temperature always return a concrete Double (0.0) even when the key is absent from storage. The @OptionalUserDefault wrapper handles optional types such as String? or Data?, returning nil when no value exists, which is necessary for properties like selectedWhisperModelPath that have no meaningful default.

Where does OpenSuperWhisper actually store these configuration values?

While AppPreferences.swift provides the Swift interface, values persist to the standard macOS UserDefaults system (typically ~/Library/Preferences/com.starmel.OpenSuperWhisper.plist). The property wrappers in AppPreferences.swift abstract this implementation detail, so application code should always access values through AppPreferences.shared rather than UserDefaults.standard to ensure type safety and migration logic execution.

Why does AppPreferences.swift contain both selectedModelPath and selectedWhisperModelPath?

selectedWhisperModelPath is the current canonical key for storing the model file path, introduced in a newer version of the app. selectedModelPath exists as a computed property that provides backward compatibility for legacy code paths. The migrateOldPreferences() function automatically copies values from the old selectedModelPath key to selectedWhisperModelPath when the app launches, ensuring existing users retain their model selection after updating.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →