Skip to content

menu_bar

diapason.desktop.menu_bar

Menu-bar presence for background dictation.

A service with no terminal has no face: you cannot tell whether it is listening, whether it heard you, or what it just wrote. The status item is the smallest thing that fixes that — an icon that changes while recording, the last transcript one click away, and a way to quit without hunting for launchctl.

Design notes:

  • The menu model (title, item labels, what each does) is pure and tested; only run() touches rumps/AppKit. A menu bar cannot be asserted on in CI, so everything that can be decided without a screen, is.
  • Icons are text, not image assets: a bundled .icns would have to be regenerated and signed, and an emoji reads correctly in both light and dark menu bars at every size.

DictationMenuBar

Live status item. Import-safe: rumps is only touched in run().

run()

Start the status item. Blocks on the AppKit run loop.

set_state(state)

Called from the dictation status callback; safe if no UI is up.

MenuItem dataclass

One row of the status menu. action is None for a separator.

build_menu(*, hotkey, last_text='', running=True)

The menu, as data.

The last transcript is shown truncated and is copyable — that is the answer to "it pasted into the wrong window", which is the most common way a dictation goes missing.

copy_to_clipboard(text)

Put text on the pasteboard without pasting it anywhere.

title_for(state)

Map a dictation state to the menu-bar glyph.

Anything unknown falls back to idle rather than raising: a status icon is never worth crashing a running service over.