Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

refactor(ui): let the capture cue and the keybind recorder serve other features

rubenluetke10-beepd1cc4600eb1d
diff --git a/jarvis/audio/effects.py b/jarvis/audio/effects.py
index 9755b6fff1..7034eb2ca6 100644
--- a/jarvis/audio/effects.py
+++ b/jarvis/audio/effects.py
@@ -51,10 +51,20 @@ class AudioEffectsService:
self, _event: ScreenCaptureGrabbed
) -> None:
"""Schedule and return; EventBus publication must never wait on audio."""
+ # Every shared-service capture is an appshot to the user, so the
+ # Appshots page's "play sound" switch owns this cue.
+ self.play_capture_cue(section="appshot")
+
+ def play_capture_cue(self, *, section: str) -> None:
+ """Play the capture click-clack once, gated by ``[<section>].sound``.
+
+ Must be called on the event loop; returns at once. ``[ui].sound_effects``
+ silences it for every section. A cue already playing absorbs the call.
+ """
current = self._capture_task
if current is not None and not current.done():
return
- task = asyncio.create_task(self._play_capture(), name="screen-capture-cue")
+ task = asyncio.create_task(self._play_capture(section), name="screen-capture-cue")
self._capture_task = task
def _clear(done: asyncio.Task[None]) -> None:
@@ -63,14 +73,12 @@ class AudioEffectsService:
task.add_done_callback(_clear)
- async def _play_capture(self) -> None:
+ async def _play_capture(self, section: str) -> None:
try:
config = await asyncio.to_thread(self._load_config)
if not bool(getattr(getattr(config, "ui", None), "sound_effects", True)):
return
- # Every shared-service capture is an appshot to the user, so the
- # Appshots page's "play sound" switch owns this cue.
- if not bool(getattr(getattr(config, "appshot", None), "sound", True)):
+ if not bool(getattr(getattr(config, section, None), "sound", True)):
return
player = self._bound_player()
if player is None:
diff --git a/jarvis/ui/web/frontend/src/views/settings/KeybindRow.tsx b/jarvis/ui/web/frontend/src/views/settings/KeybindRow.tsx
index 22768b01c5..c0a048beca 100644
--- a/jarvis/ui/web/frontend/src/views/settings/KeybindRow.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/KeybindRow.tsx
@@ -194,14 +194,16 @@ export function ComboChips({ combo }: { combo: string }) {
export function validationText(
v: ComboValidation,
t: (key: string) => string,
+ actionLabel?: (action: string) => string | undefined,
): string | null {
if (v.status === "error" && v.reason === "collision" && v.conflict) {
// The conflict carries the ACTION ID (unique); the message names it the way
// the UI labels that row. An id the frontend does not know yet (a newer
// backend) falls back to the raw id instead of rendering an empty name.
const labelKey = ACTION_LABEL_KEY[v.conflict.action as KeybindAction];
+ const named = actionLabel?.(v.conflict.action) ?? (labelKey ? t(labelKey) : undefined);
return t("settings_view.keybinds.validation.collision")
- .replace("{action}", labelKey ? t(labelKey) : v.conflict.action)
+ .replace("{action}", named ?? v.conflict.action)
.replace("{combo}", formatCombo(v.conflict.combo));
}
const cautions = v.cautions ?? [];
@@ -235,6 +237,12 @@ export interface KeybindRowProps {
* pins the dictation mode to "hold"). Failures are the owner's to report.
*/
onSaved?: (combo: string) => void | Promise<void>;
+ /**
+ * Names a sibling row for "already used by …" when the rows are not the
+ * voice keybinds (whose labels `ACTION_LABEL_KEY` knows) — another feature's
+ * shortcut list reusing this recorder.
+ */
+ actionLabel?: (action: string) => string | undefined;
}
/**
@@ -253,6 +261,7 @@ export function KeybindRow({
variant = "settings",
suggestions,
onSaved,
+ actionLabel,
}: KeybindRowProps) {
const t = useT();
const pushToast = useEventStore((s) => s.pushToast);
@@ -287,11 +296,11 @@ export function KeybindRow({
for (const [act, c] of Object.entries(config.keybinds)) {
if (act === action) continue;
const labelKey = ACTION_LABEL_KEY[act as KeybindAction];
- const lbl = labelKey ? t(labelKey) : act;
+ const lbl = actionLabel?.(act) ?? (labelKey ? t(labelKey) : act);
for (const tok of comboTokens(c ?? "")) out[tok] = lbl;
}
return out;
- }, [config, action, t]);
+ }, [config, action, t, actionLabel]);
// The OTHER actions' combos keyed by their ACTION ID. Keying by the translated
// label collapsed two rows that happen to share a label into one entry, so one
@@ -316,7 +325,7 @@ export function KeybindRow({
() => validateCombo(combo, otherCombos),
[combo, otherCombos],
);
- const validationMsg = validationText(validation, t);
+ const validationMsg = validationText(validation, t, actionLabel);
// Click-to-assign: toggle a key in/out of the combo without a physical press.
// Functional update — toggles dispatched before the next render must each