Building per-app dictation on macOS: focus, profiles, and optional send
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…
Clavio is hands-free dictation software for Mac computers. Its developers explain how the app separates application identity, writing preferences, listening mode, and delivery. The code examples are based on the Mac implementation and presented as pseudocode.
The app identifies the active application using its unique bundle identifier, rather than relying on the display name. It maintains two additional values: the last activated external app and the session target. The session target preserves context when Clavio's UI appears.
A profile consists of independent user preferences such as writing style, listening mode, custom wake phrases, and post-insertion actions. These preferences are stored keyed by the application's bundle ID. Clavio separates listening preferences from writing preferences, allowing users to choose different settings for different applications.
When a user sets an intensity and tone override, Clavio's resolver checks the explicit preference first, followed by app-derived defaults, global user defaults, and finally built-in fallback values. Tone and intensity are resolved separately to preserve the distinction between the two. The resolver prioritizes explicit app overrides over catalog entries or user defaults when available.
Listening mode is determined by an explicit per-app override, falling back to the global mode if none is set. Clavio's coordinator consumes this result when the active application changes. The distinction between wake-word detection and always-on listening must be maintained, even if the underlying detector fails.
After dictation ends, the text is transcribed and writing settings are resolved. The text is then ready to be sent to a destination app, where additional checks ensure safe delivery, such as avoiding password fields. The insertion process involves separate checks for security-sensitive destinations, ensuring Clavio maintains control over where text is ultimately sent.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.