Introducing a new way to review your PRs.

Read the announcement

altic-dev / fluidvoice

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

View on GitHub

24 documents · Updated Nov 23, 2026

docs / application-lifecycle-and-menu-bar

Application lifecycle and menu bar

FluidVoice is a macOS voice app that starts as a SwiftUI application and stays available from the menu bar. Launch work prepares shared services and user state before recording begins. The menu bar then gives the user a persistent way to record, open the app, choose audio input, manage updates, and quit.

See App experience, Recording overlays and modes, and Software updates for related user flows.

Application startup

The startup model separates the SwiftUI scene from macOS lifecycle work. FluidApp owns the main scene and shares the menu-bar manager and service container with ContentView. AppDelegate handles work that must happen at launch, activation, and termination. This gives the app one shared service set while the main window and menu bar follow different visibility rules.

Launch sequence

The launch sequence prepares saved state and background services before it exposes recording controls. It loads settings and history, restores onboarding state, starts local services, prepares analytics and notifications, schedules update checks, and realizes the SwiftUI content. It also resumes pending AI setup, refreshes speech-model state, and schedules meeting auto-detection when enabled. In debug launches, selected hardware checks can stop the normal path so diagnostics do not share audio resources with the app.

The sequence below shows how macOS launch work leads to the main scene and delayed audio startup.

flowchart TD
    A[macOS launches app] --> B[AppDelegate prepares lifecycle services]
    B --> C[SwiftUI creates main scene]
    C --> D[ContentView appears]
    D --> E[Menu bar is created]
    D --> F[UI-ready gate opens]
    F --> G[Audio and speech services initialize]
    G --> H[Menu bar observes recording state]

Login-item launches can keep the main window hidden when the related setting is off. The window still becomes ready so content startup can create the menu bar and prepare user-facing state. Manual launches and configured login launches bring the window to the front.

References: Sources/…/AppDelegate.swift• L51-133 Sources/…/AppDelegate.swift• L329-375

Service composition

AppServices is the shared boundary for app-wide audio and speech work. It delays heavy service creation until the first UI render is complete. ContentView then signals that the UI is ready and opens the audio startup gate. This keeps launch responsive and avoids hardware work while SwiftUI builds its view graph.

References: Sources/…/AppServices.swift• L20-41 Sources/…/AppServices.swift• L43-69 Sources/…/ContentView.swift• L603-630

Application activation

Application activation restores cached key state and records normal app activity after the short suppression window used for login-item launches. This keeps background startup from being counted as a user return while still tracking later foreground use.

References: Sources/…/AppDelegate.swift• L267-281

Application termination

Termination first waits for pending transcription-history writes. If saving fails, the app asks whether to keep the app open or quit anyway. After termination is approved, the delegate stops local services and update checks, closes search state, and waits for speech and private AI runtimes to shut down. Bounded waits prevent a stalled runtime from holding the process forever.

References: Sources/…/AppDelegate.swift• L136-185 Sources/…/AppDelegate.swift• L187-251

An update restart uses the same save and shutdown protection before it requests termination. The next app instance starts only after the old process exits, so the two instances do not overlap.

References: Sources/…/AppDelegate.swift• L17-34 Sources/…/AppDelegate.swift• L155-180

Main window management

The main window is the user-facing SwiftUI surface. The Dock, menu bar, notifications, and update prompts can all open it. The app treats window creation and activation as separate concerns. It reuses a suitable window when possible and creates a fresh hosted window when the existing one is missing or unusable. Both paths receive the same shared services.

References: Sources/…/AppDelegate.swift• L428-492 Sources/…/MenuBarManager.swift• L1434-1475 Sources/…/MenuBarManager.swift• L1606-1639

Window visibility policy

The saved Dock preference controls whether macOS presents the app as a normal Dock application or as an accessory app. The login-launch preference controls whether the main window appears at login. These settings affect visibility only. The app still realizes its main content when it needs the menu bar and service startup to run. Reopening the running app reapplies the Dock policy because macOS can restore its default activation policy.

References: Sources/…/AppDelegate.swift• L253-265 Sources/…/AppDelegate.swift• L321-425 Sources/…/SettingsStore.swift• L2381-2415 Sources/…/SettingsStore.swift• L1370-1384

The menu bar is FluidVoice's persistent control surface. MenuBarManager owns one status item and keeps its icon, menu text, accessibility announcements, and recording overlay aligned with speech and meeting activity. It also makes audio-capture errors visible by opening the main window when the user has closed it.

References: Sources/…/MenuBarManager.swift• L15-24 Sources/…/MenuBarManager.swift• L95-204 Sources/…/MenuBarManager.swift• L266-359 Sources/…/MenuBarManager.swift• L852-924

The menu bridges background recording with the main app UI. It exposes these user actions:

  • Start or stop meeting recording and open the latest meeting transcript.
  • Show recording status and the active dictation shortcut.
  • Copy the latest transcript when one is available.
  • Open the main window or a specific settings area.
  • Choose a microphone from the saved priority list.
  • Check for updates or roll back to a saved version.
  • Quit FluidVoice.

The microphone list refreshes when the menu opens. It reconciles available devices with the saved priority order and prevents device changes during recording. Meeting actions guard against duplicate start and stop requests. Errors remain in the menu instead of forcing main-window navigation.

References: Sources/…/MenuBarManager.swift• L971-1090 Sources/…/MenuBarManager.swift• L1210-1297 Sources/…/MenuBarManager.swift• L1324-1432 Sources/…/MenuBarManager.swift• L1497-1562

Recording state presentation

The manager turns speech-service and meeting-session state into user-visible menu and overlay state. Dictation updates the status item and menu text. Meeting recording moves through preparation, recording, stopping, processing, completion, interruption, and failure states. Accessibility announcements provide the same state changes without requiring the menu to be open.

References: Sources/…/MenuBarManager.swift• L266-359 Sources/…/MenuBarManager.swift• L1092-1197

When dictation stops during post-processing, the manager defers the stopped-state menu refresh until the result path is ready. The overlay stays visible during processing so the user sees one continuous recording-to-result flow. The overlay modes are covered in Recording overlays and modes.

References: Sources/…/MenuBarManager.swift• L164-203 Sources/…/MenuBarManager.swift• L386-510 Sources/…/MenuBarManager.swift• L668-830

Meeting recording controls

Meeting recording is available from the menu bar when FluidMeet is enabled. The menu shows whether a session is starting, recording, stopping, transcribing, complete, interrupted, or failed. It uses guarded actions so source discovery, permission waits, and stop requests do not create duplicate sessions. A meeting shortcut uses the same guards without starting dictation or forcing navigation to the main window.

References: Sources/…/MenuBarManager.swift• L1130-1197 Sources/…/MenuBarManager.swift• L1497-1562

Navigation uses lightweight requests instead of giving background services direct control over SwiftUI selection state. A request names a destination and is consumed by ContentView when the main UI is present. This lets a menu action, update prompt, notification, or overlay open the right screen without knowing how that screen is laid out.

References: Sources/…/AppNavigationRouter.swift• L3-32 Sources/…/ContentView.swift• L347-355 Sources/…/MenuBarManager.swift• L1572-1595

AppNavigationState defines the shared vocabulary for app pages and settings sections. SidebarItem identifies main destinations. SettingsSection identifies settings areas. SettingsNavigationState also stores the app page to return to when settings closes. It captures that page when settings first opens, so moving inside settings does not change the return target.

References: Sources/…/AppNavigationState.swift• L10-23 Sources/…/AppNavigationState.swift• L25-61 Sources/…/AppNavigationState.swift• L63-89

Menu actions first bring the main window forward and then publish a one-shot destination for ContentView. Settings, custom dictionary, microphone settings, and meeting transcription map to their related app or settings screen. A generation counter and short retry window help the request reach a view that is still becoming active.

References: Sources/…/MenuBarManager.swift• L1485-1495 Sources/…/MenuBarManager.swift• L1572-1604 Sources/…/ContentView.swift• L957-1005

External navigation

External events use the shared app router for destinations such as AI settings and history. ContentView consumes a pending request when it appears and when the navigation notification arrives. A notification can therefore activate the app and open the related result without coupling notification code to the sidebar.

References: Sources/…/AppDelegate.swift• L291-305 Sources/…/AppNavigationRouter.swift• L16-25 Sources/…/ContentView.swift• L560-583 Sources/…/ContentView.swift• L972-981

Sidebar selection also controls the overlay mode used during recording. Entering command or rewrite mode changes the overlay presentation. Leaving those modes clears mode-specific state. This keeps main-window navigation and the recording surface aligned.

References: Sources/…/ContentView.swift• L911-955

Update handling

Updates are available from the menu bar and are also checked in the background. The update service compares the installed version with project releases and supports the stable or beta channel selected by the user. It prevents overlapping update operations and can install a newer app or restore a prior local backup. See Software updates for the update-specific user flow.

References: Sources/…/AppDelegate.swift• L494-527 Sources/…/SimpleUpdater.swift• L111-159 Sources/…/SimpleUpdater.swift• L300-347

Automatic update checks

The delegate performs an initial delayed check when automatic checks are enabled. It repeats checks about once per hour while the app runs. The saved last-check time prevents repeated requests. An available version produces a prompt unless the user has snoozed that version. Failed automatic checks are logged without interrupting the user.

References: Sources/…/AppDelegate.swift• L496-527 Sources/…/SettingsStore.swift• L2417-2453

Manual update actions

Manual checks show a direct result to the user. The user can install an available update or postpone it. The menu also exposes rollback when a prior app backup exists. If no local backup exists, it offers recent release builds or the full release page.

References: Sources/…/AppDelegate.swift• L508-512 Sources/…/MenuBarManager.swift• L1324-1432

Update restart

An accepted update uses a controlled restart instead of replacing the running app in place. The app saves pending history, shuts down services, waits for the old process to exit, and then starts the updated app. This protects recent data and prevents two active app instances during replacement.

References: Sources/…/AppDelegate.swift• L17-34 Sources/…/AppDelegate.swift• L155-180 Sources/…/SimpleUpdater.swift• L854-925

Update safety

Installation accepts only a suitable release asset and a valid app bundle. Release builds also require an approved code-signing identity transition. The current app is backed up before replacement. The new instance relaunches only after the old instance exits. These checks protect the running app from malformed, incompatible, or untrusted update packages.

References: Sources/…/SimpleUpdater.swift• L335-468 Sources/…/SimpleUpdater.swift• L652-707 Sources/…/SimpleUpdater.swift• L854-925

Notification handling

Notifications report failures that occur after the user has started a task and may no longer be watching the main window. NotificationService checks the user's failure-notification setting and macOS permission state before it delivers a notification.

References: Sources/…/NotificationService.swift• L4-41 Sources/…/SettingsStore.swift• L3170-3179

Failure notification routes

AI post-processing failures notify the user that raw transcription was typed instead. Command Mode failures notify the user that setup is needed. Each notification carries a kind value so the app can distinguish an actionable AI fallback from other failures.

References: Sources/…/NotificationService.swift• L44-119 Sources/…/ContentView.swift• L2287-2315 Sources/…/CommandModeService.swift• L498

Notification activation

The app delegate shows failure notifications as banners and in the notification list. Selecting an AI fallback notification routes the user to history and brings the main window forward. This gives the user a recovery path without interrupting every recording or task.

References: Sources/…/AppDelegate.swift• L283-305

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep FluidApp environment objects and manually created main windows aligned so both entry paths provide the same shared services.
  • Keep login-item visibility rules consistent with Dock activation policy changes that can occur when LaunchServices reopens the app.
  • Keep startup indexing and its source stores aligned so search is ready after launch without blocking the main window.
  • Keep SidebarItem, SettingsSection, menu destinations, and meeting destinations aligned so every route maps to a valid app page or settings section.
  • Keep one-shot menu requests and pending external requests deliverable when the main window is already open or still starting.
  • Keep notification kind values aligned between notification creation and delegate response handling.
  • Keep update-channel settings, release selection, install gating, restart preparation, and rollback availability consistent across automatic checks and menu actions.
  • Keep service startup behind the UI-ready and audio startup gates when adding work that touches audio or speech hardware.
  • Keep termination approval tied to pending history writes so the app does not exit before it can report a save failure or finish the write.
  • Keep update restarts from relaunching until the old process has exited, and keep the restart path from bypassing required service shutdown.
  • Keep all long-running runtime shutdown paths bounded so one stalled service does not block application exit indefinitely.
  • Keep audio-capture failure presentation connected to the menu-bar path so a closed main window does not hide a recording error.
  • Keep deferred recording-state updates flushed after processing so the menu, status item, and overlay do not show conflicting states.
  • Keep meeting start and stop guards aligned with coordinator state so repeated menu clicks cannot create competing sessions.
  • Keep meeting state labels and accessibility announcements aligned with the coordinator's recovery and completion states.

Important failure modes

TriggerConsequenceGuard
Heavy audio or speech work starts before the first UI renderLaunch can fail or audio can race SwiftUI startupAppServices stays lazy and ContentView opens service initialization after the UI-ready delay
Login launch hides the window and skips content realizationThe menu bar and service startup do not become availableThe launch path realizes the main window invisibly before ordering it out
LaunchServices reopens the app after a hidden login launchThe user's hide-from-Dock choice can be lostThe delegate reapplies the saved activation policy after reopen
A menu navigation request arrives before the main view is activeThe requested settings, meeting, or history screen may not openThe manager republishes the destination after window activation and retains it for a short retry window
A menu or external destination no longer matches shared navigation stateThe app can open the wrong page or fail to enter the requested settings sectionShared navigation types and consuming routes use the same destination vocabulary
Settings dismissal loses its saved app destinationBack to app can return to the wrong pageSettingsNavigationState captures the return destination when settings first opens
Recording stops while post-processing still owns the overlayThe menu can show a final stopped state too early or the overlay can disappear before the result is readyMenuBarManager defers the stopped-state refresh and flushes it when processing ends
Audio capture fails while the main window is closedThe user can miss the recording error while using only the menu barThe capture-failure event opens the main window after recording stops
Meeting start or stop is clicked more than onceCompeting requests can create a bad meeting state or duplicate workMenu actions use start and stop request guards and follow coordinator state
Automatic and manual update actions overlapTwo update installs can compete or corrupt the app transitionSimpleUpdater uses one update-operation gate
An update package has no suitable asset, app bundle, or trusted signatureInstallation stops before replacing the running appRelease selection, bundle validation, and code-sign checks run before the swap
An update restart begins before history or runtime shutdown finishesThe app can lose recent history or leave two app instances activeRestart preparation waits for writes and service shutdown, then schedules relaunch after process exit
Notification permission is denied or the failure setting is offNo failure banner is shownNotification delivery checks both the saved preference and system authorization
Pending history writes fail during terminationThe app can lose the latest saved history unless the user keeps it openTermination waits for pending writes and offers Keep Open before exit
A runtime does not finish shutdown before its deadlineThe app exits with cleanup incompleteEach termination path has a bounded wait and records a timeout

Key files

FileWhy to read it
Sources/…/fluidApp.swiftDefines the SwiftUI entry point, main scene, shared environment objects, and app settings command.
Sources/…/AppDelegate.swiftCoordinates macOS launch and termination, restart safety, activation policy, window activation, notifications, and update checks.
Sources/…/ContentView.swiftConnects first appearance, service readiness, sidebar routing, settings presentation, and external navigation to the main UI.
Sources/…/AppNavigationState.swiftDefines the shared app-page and settings-section state used by navigation and return paths.
Sources/…/AppServices.swiftDefines the shared service boundary and the UI-ready startup rule.
Sources/…/MenuBarManager.swiftDefines the persistent menu-bar surface, meeting controls, window access, navigation requests, recording-state bridge, overlay lifecycle, and audio-error recovery path.
Sources/…/AppNavigationRouter.swiftDefines app-level destinations sent from background events into SwiftUI navigation.
Sources/…/SimpleUpdater.swiftDefines release discovery, update installation, signing checks, and rollback behavior.
Sources/…/NotificationService.swiftDefines failure notification permission checks, message types, and activation payloads.
Sources/…/SettingsStore.swiftDefines the saved visibility, update, beta-channel, and failure-notification preferences used by lifecycle services.