今日已更新 304 条资讯 | 累计 42362 条内容
关于我们

Building per-app dictation on macOS: focus, profiles, and optional send

Clavio App 2026年09月12日 17:31 1 次阅读 来源:Dev.to

Dictating a coding prompt and dictating an email can involve the same microphone and speech recognizer. They should not necessarily involve the same writing style—or the same action after the text appears. We build Clavio, hands-free dictation for Mac , at Just Tools LTD. This is a developer's explanation of one part of the app: how we separate application identity, writing preferences, listening mode, and delivery. The implementation details below are based on our Mac code; the short pseudocode is illustrative, not a drop-in library. The video above is our existing walkthrough, including wake-word setup and a separate profile for Claude. 1. “The active app” is more than one value On macOS, NSWorkspace exposes the frontmost application and an application-activation notification. That gives a useful starting point: identify an app by its bundle identifier, not its display name. But reading the frontmost app only when transcription finishes is too late. Someone can start dictating in an editor, click the dictation panel, and finish speaking while that panel has focus. The panel should not become the writing-style target merely because it is visible. We distinguish three values: Value What it represents Why keep it? Live frontmost app The latest activated app, including Clavio Current UI and focus decisions Last external app The latest activated app other than Clavio Preserve useful context when our own UI appears Session target The target selected when a recording session starts Keep processing associated with that session Clavio seeds the focus cache on launch and updates it from activation notifications. Published UI state is updated on the main queue. This also avoids repeatedly requesting application information in UI hot paths. There is an important edge case: starting dictation inside Clavio must not blindly reactivate an older external app. A remembered target is context, not permission to send text anywhere. Apple documents the underlying application-activatio

本文内容来源于互联网,版权归原作者所有
查看原文