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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(ui): add the 'Bar size' slider to Settings (Appearance)
Ruben Lütkeb4b8345eee3f
diff --git a/jarvis/ui/web/frontend/src/hooks/useBarSize.ts b/jarvis/ui/web/frontend/src/hooks/useBarSize.tsnew file mode 100644index 0000000000..e6d9f43b7a--- /dev/null+++ b/jarvis/ui/web/frontend/src/hooks/useBarSize.ts@@ -0,0 +1,67 @@+import { useCallback, useEffect, useState } from "react";++/**+ * On-screen "Bar size" multiplier from GET /api/settings/bar-size. The value is+ * a 0.5–2.0 proportional factor (1.0 = the signed-off default look); the UI+ * renders it as a percent slider. Mirrors useTtsVolume, but setScale takes a+ * `persist` flag so the slider can stream LIVE (persist=false) resizes while+ * dragging and write jarvis.toml once on release (persist=true).+ */+export interface BarSizeConfig {+ scale: number;+ default: number;+ min: number;+ max: number;+}++export interface BarSizeSaveResult {+ ok: boolean;+ scale: number;+ default: number;+ persisted: boolean;+ applied_live: boolean;+ restart_required: boolean;+}++/** Loads /api/settings/bar-size and exposes setScale(scale, persist?). */+export function useBarSize() {+ const [config, setConfig] = useState<BarSizeConfig | null>(null);+ const [loading, setLoading] = useState(true);+ const [error, setError] = useState<string | null>(null);++ const refetch = useCallback(async () => {+ setError(null);+ try {+ const res = await fetch("/api/settings/bar-size");+ if (!res.ok) throw new Error(`HTTP ${res.status}`);+ const data: BarSizeConfig = await res.json();+ setConfig(data);+ } catch (e) {+ setError((e as Error).message);+ } finally {+ setLoading(false);+ }+ }, []);++ useEffect(() => {+ void refetch();+ }, [refetch]);++ const setScale = useCallback(+ async (scale: number, persist = true): Promise<BarSizeSaveResult> => {+ const res = await fetch("/api/settings/bar-size", {+ method: "PUT",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ scale, persist }),+ });+ const body = await res.json().catch(() => ({}));+ if (!res.ok) throw new Error(body.detail ?? `HTTP ${res.status}`);+ const result = body as BarSizeSaveResult;+ setConfig((prev) => (prev ? { ...prev, scale: result.scale } : prev));+ return result;+ },+ [],+ );++ return { config, loading, error, refetch, setScale };+}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 2ad45a7149..a8f8d12953 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -1137,6 +1137,13 @@"saved_toast": "Lautstärke auf {0} gesetzt.","restart_caption": "Gespeichert — wird beim nächsten Start aktiv."},+ "bar_size": {+ "title": "Bar-Größe",+ "description": "Wie groß die Bar auf dem Bildschirm ist. Sie skaliert proportional — Breite und Höhe zusammen — sodass die Bar ihre Form behält und sich nur die Größe ändert. Zum Ändern live am Bildschirm ziehen.",+ "reset": "Auf Standard zurücksetzen (100%)",+ "saved_toast": "Bar-Größe auf {0} gesetzt.",+ "restart_caption": "Gespeichert — wird beim Neustart der Bar aktiv."+ },"audio_devices": {"title": "Audiogeräte","description": "Lege fest, wo die Stimme von {name} herauskommt und mit welchem Mikrofon {name} zuhört. Automatisch wählt dein Headset für dich und passt sich an, wenn Geräte kommen und gehen.",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex 33a3c6a7b0..7759dd199e 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -1138,6 +1138,13 @@"saved_toast": "Volume set to {0}.","restart_caption": "Saved — applies on next start."},+ "bar_size": {+ "title": "Bar size",+ "description": "How big the on-screen bar is. It scales proportionally — width and height together — so the bar keeps its shape and only its size changes. Drag to resize it live on screen.",+ "reset": "Reset to default (100%)",+ "saved_toast": "Bar size set to {0}.",+ "restart_caption": "Saved — applies when the bar restarts."+ },"audio_devices": {"title": "Audio devices","description": "Pick where {name}'s voice comes out and which microphone {name} listens with. Automatic picks your headset for you and adapts when devices come and go.",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 7edc8d13f5..3c61733eba 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -1137,6 +1137,13 @@"saved_toast": "Volumen fijado en {0}.","restart_caption": "Guardado — se aplica en el próximo inicio."},+ "bar_size": {+ "title": "Tamaño de la barra",+ "description": "Qué tan grande es la barra en pantalla. Escala de forma proporcional — ancho y alto juntos — así que la barra mantiene su forma y solo cambia su tamaño. Arrastra para redimensionarla en vivo en pantalla.",+ "reset": "Restablecer al valor predeterminado (100%)",+ "saved_toast": "Tamaño de la barra fijado en {0}.",+ "restart_caption": "Guardado — se aplica al reiniciar la barra."+ },"audio_devices": {"title": "Dispositivos de audio","description": "Elige por dónde sale la voz de {name} y con qué micrófono escucha {name}. Automático elige tu auricular por ti y se adapta cuando los dispositivos van y vienen.",diff --git a/jarvis/ui/web/frontend/src/views/settings/BarSizeGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/BarSizeGroup.tsxnew file mode 100644index 0000000000..c906604e42--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/settings/BarSizeGroup.tsx@@ -0,0 +1,163 @@+import { useEffect, useRef, useState } from "react";+import { Maximize2 } from "lucide-react";+import { useBarSize } from "@/hooks/useBarSize";+import { useEventStore } from "@/store/events";+import { useT } from "@/i18n";++/**+ * "Bar size" slider inside the Settings view. Tunes how big the on-screen bar+ * is — a proportional multiplier that scales WIDTH and HEIGHT together, so the+ * pill keeps its shape and only its size changes (0.5–2.0, presented as+ * 50–200%, default 100%). Unlike the Volume/Silence sliders (which commit only+ * on release), this one streams LIVE resizes while dragging — throttled, with+ * persist=false — so the bar grows/shrinks on screen in real time, then writes+ * jarvis.toml once on release (persist=true). The change applies live to the+ * running bar; a headless host falls back to "applies on next start".+ */+const LIVE_THROTTLE_MS = 60;++export function BarSizeGroup() {+ const t = useT();+ const { config, loading, setScale } = useBarSize();+ const pushToast = useEventStore((s) => s.pushToast);++ // Local slider value in PERCENT (50–200). Mirrors the server scale once GET+ // resolves; the label + the on-screen bar follow it live while dragging.+ const [pct, setLocalPct] = useState(100);+ const [saving, setSaving] = useState(false);+ // The last percent we actually PERSISTED — guards an idle mouseUp (no drag)+ // from firing a redundant persist PUT.+ const committedRef = useRef(100);+ // Live-throttle bookkeeping for the drag stream (persist=false).+ const lastLiveRef = useRef(0);+ const pendingRef = useRef<ReturnType<typeof setTimeout> | null>(null);++ const min = Math.round((config?.min ?? 0.5) * 100);+ const max = Math.round((config?.max ?? 2) * 100);+ const def = Math.round((config?.default ?? 1) * 100);++ useEffect(() => {+ if (config) {+ const p = Math.round(config.scale * 100);+ setLocalPct(p);+ committedRef.current = p;+ }+ }, [config]);++ // Clear any pending trailing live-send if the view unmounts mid-drag.+ useEffect(+ () => () => {+ if (pendingRef.current) clearTimeout(pendingRef.current);+ },+ [],+ );++ // One live (persist=false) resize — resizes the on-screen bar without a disk+ // write. A transient error is swallowed; the release PUT reconciles.+ function sendLive(nextPct: number) {+ void setScale(nextPct / 100, false).catch(() => {+ /* transient live-apply error — the release persist PUT reconciles */+ });+ }++ // Drag handler: update the label instantly, then live-resize the bar,+ // throttled so a fast drag does not storm the backend while always+ // trailing-flushing the latest value so the bar lands on the final size.+ function onDrag(nextPct: number) {+ setLocalPct(nextPct);+ const now = Date.now();+ if (pendingRef.current) {+ clearTimeout(pendingRef.current);+ pendingRef.current = null;+ }+ if (now - lastLiveRef.current >= LIVE_THROTTLE_MS) {+ lastLiveRef.current = now;+ sendLive(nextPct);+ } else {+ pendingRef.current = setTimeout(() => {+ lastLiveRef.current = Date.now();+ pendingRef.current = null;+ sendLive(nextPct);+ }, LIVE_THROTTLE_MS);+ }+ }++ // Release handler: persist the final value to jarvis.toml (once).+ async function commit(nextPct: number) {+ if (pendingRef.current) {+ clearTimeout(pendingRef.current);+ pendingRef.current = null;+ }+ if (nextPct === committedRef.current) return; // no net change → no persist+ committedRef.current = nextPct;+ setSaving(true);+ try {+ const res = await setScale(nextPct / 100, true);+ pushToast(+ res.applied_live ? "success" : "warning",+ res.applied_live+ ? t("settings_view.bar_size.saved_toast").replace("{0}", `${nextPct}%`)+ : t("settings_view.bar_size.restart_caption"),+ );+ } catch (e) {+ pushToast("error", (e as Error).message);+ // Revert the local value to the last persisted so the UI does not lie.+ setLocalPct(committedRef.current);+ sendLive(committedRef.current);+ } finally {+ setSaving(false);+ }+ }++ function onReset() {+ setLocalPct(def);+ sendLive(def);+ void commit(def);+ }++ const showReset = pct !== def;++ return (+ <div className="mt-2 rounded-lg border border-border bg-card/60 p-4">+ <div className="flex items-start gap-3">+ <Maximize2 className="mt-0.5 h-4 w-4 shrink-0 text-primary" />+ <div className="min-w-0 flex-1">+ <div className="flex items-center justify-between gap-4">+ <h4 className="font-display text-sm font-semibold">+ {t("settings_view.bar_size.title")}+ </h4>+ <span className="font-mono text-sm text-primary">{`${pct}%`}</span>+ </div>+ <p className="mt-1 text-xs text-muted-foreground">+ {t("settings_view.bar_size.description")}+ </p>++ <input+ type="range"+ min={min}+ max={max}+ step={5}+ value={pct}+ disabled={loading}+ onChange={(e) => onDrag(Number(e.target.value))}+ onMouseUp={() => void commit(pct)}+ onKeyUp={() => void commit(pct)}+ onTouchEnd={() => void commit(pct)}+ className="mt-4 w-full accent-primary disabled:opacity-50"+ />++ {showReset && (+ <button+ type="button"+ onClick={onReset}+ disabled={saving}+ className="mt-3 text-[11px] text-muted-foreground underline hover:text-foreground disabled:opacity-50"+ >+ {t("settings_view.bar_size.reset")}+ </button>+ )}+ </div>+ </div>+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/views/settings/OverlayTaskbarGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/OverlayTaskbarGroup.tsxindex 53c5951d41..6a28b800e2 100644--- a/jarvis/ui/web/frontend/src/views/settings/OverlayTaskbarGroup.tsx+++ b/jarvis/ui/web/frontend/src/views/settings/OverlayTaskbarGroup.tsx@@ -4,6 +4,7 @@ import { Switch } from "@/components/ui/switch";import { useOverlayStyle, type OverlayStyle } from "@/hooks/useOverlayStyle";import { StylePreview } from "@/components/overlay/OverlayStylePreviews";import { useBarPersistent } from "@/hooks/useBarPersistent";+import { BarSizeGroup } from "@/views/settings/BarSizeGroup";import { useMuteMusic } from "@/hooks/useMuteMusic";import { useSoundEffects } from "@/hooks/useSoundEffects";import { useEventStore } from "@/store/events";@@ -31,6 +32,7 @@ export function OverlayTaskbarGroup() {{t("taskbar_view.appearance_title")}</h4><OverlayStylePanel />+ <BarSizeGroup /></section><section>