Files
capri-core-rust/crates/capri-ui
nocodeandClaude Opus 5.5 49349d6ecd
CI / test (push) Has been cancelled
Linux port: first run, packaging, single instance, privacy and wiring
First run and backend
- The companion opens without Ollama or a model (OFFLINE / SETUP REQUIRED),
  opens Settings > Language model and picks the model up once downloaded.
- Model, provider and GPU changes apply without restarting (Ollama is
  restarted when launch settings change); no silent fallback from API mode.
- Fatal startup errors are shown in a window; the fallback avatar loads
  again; the shipped Capri artwork is used when nothing was imported.

Packaging and tooling
- packaging/arch/PKGBUILD, capri.desktop (KWin ScreenShot2 key), icons,
  artwork under /usr/share/capri/assets, Gitea Actions CI.
- xtask: `icons` and `release-check` (no private data or credentials).

Runtime
- One instance per data folder (flock + control socket): second launch
  shows the window; capri stop / restart / toggle / status (JSON, starts
  nothing) / doctor / setup / diagnostics export / purge.
- A foreign program on the Ollama port is refused; an Ollama left behind
  by Capri is replaced.

Privacy and security
- No raw Ollama log on disk; API keys are never saved in plaintext (old
  ones move to the keyring); refused credential notes are stored as
  [Credentials omitted]; launched apps get an allow-listed environment.

Fixes
- Stop/Escape silence the voice; saved voice effects apply to replies;
  settings_control glitch settings apply; distinct KWin cursor scripts;
  KDE window capture authorized for source builds; Linux wording.
- Voice pack references zipped with Windows separators are found.

Wired features
- Initiatives, request router, resource monitor, "clip that", questions
  about a snapshot, sleep mode, tap reactions, stopwatch, attachments,
  Internet mode button, voice-synced subtitles, wake visuals, dictation
  draft, tray switches, Spotify seek/shuffle/repeat; computer-control
  planner and classifier follow model switches and API mode.
- Approval cards: one shown, 8 queued, deduplicated, cancelled on stop,
  failure, lock or pause; one Application access switch.

Desktop
- Compositor detection (no black overlay on i3 without picom), i3lock
  detection, unsupported desktops reported at startup, screenshot-only
  control without AT-SPI, fontconfig fallbacks, translatable feature
  pages with French translations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 20:21:40 +01:00
..
2026-11-11 20:20:48 +01:00
2026-11-11 20:20:49 +01:00

capri-ui

Capri's desktop shell in egui/eframe (glow), forced onto winit's X11 backend: native X11 on i3, XWayland on KDE Plasma Wayland. Specs: docs/spec/03-avatar-shell.md (AV-), docs/spec/04-ui-panels.md (UI-).

Window Kind Notes
Companion Capri 480 x 660 managed, transparent, undecorated, above, sticky, skip taskbar X11 input shape = header, composer, reply, cards, sprite box + 12 px: the rest is click-through
Settings Capri Settings managed, opaque #07131c, undecorated docked left (or right) of the companion
Desktop avatar Capri Avatar override-redirect, transparent, work-area sized input shape = body box + HUD; raised every 750 ms
Mini composer Capri Composer 344 x 44 managed, focusable shown while detached, within 90 px of the pointer or with a draft
Chip Capri Chip 52 x 52 managed, above shown when hidden to tray (setting)

Modules: avatar (sprite loader, portrait, mouth plates, intro), detach (detach state machine, overlay, composer, docking), teleport (lightning choreography and drag tether, ported from avatar-teleport-motion.mjs / avatar-drag-tether.mjs), dock (docking geometry, movement commands), body (hit regions, face landmarks), fx (glitch, CRT shader, dimming, sleep caption), desktop (KWin scripting over D-Bus, i3 IPC, EWMH fallback, real cursor), x11 (EWMH states, input shapes), settings (UiSettings, theme palette), settings_window, i18n, tray, chip, sound, hooks (UiHandle, approvals).

Integration

Public API

pub fn run(
    rt: tokio::runtime::Handle,
    engine: Arc<capri_agent::Engine>,
    store: Arc<capri_core::SettingsStore>,
    pages: Vec<capri_ui::SettingsPage>,
    ui: capri_ui::UiHandle,
) -> anyhow::Result<>; // blocks until Quit

pub struct SettingsPage { pub section: String, pub title: String, pub draw: Box<dyn FnMut(&mut egui::Ui) + Send> }

run itself:

  • calls engine.set_approvals(Arc::new(ui.clone)): tool confirmations become exact, temporary approval cards (title translated, detail verbatim, countdown, Confirm/Cancel). Expiry, a dropped card or anything but Confirm returns false. A card reveals a hidden companion (not in focus mode).
  • forwards every SettingsStore change to engine.update_settings.
  • starts the tray, the KWin cursor script (KDE) and unloads it on exit.

Create the UiHandle before run and clone it into the crates that drive the shell:

Hook Caller Effect
set_mouth_level(0..=3) voice (RMS -> visemes closed/small/round/wide, ) mouth plates on standing frames and reviewed poses
set_speaking(bool) voice playback SPEAKING status, speech clip; false closes the mouth
set_music(Option<f32>) music listening (BPM 40..240 with enough confidence) dance sway, 12 fps held
set_sleeping(bool) sleep service closed eyes, Zzz. caption, silent taps
set_wake(Wake::Listening / Heard / Off) microphone / wake word I'M LISTENING, HEARD YOU (900 ms)
set_stopwatch(Option<Stopwatch>) timers HH:MM:SS in the header
set_attachments(Arc<dyn Attachments>) attachments feature dropped files -> add, chips from names, remove
on_tap(Arc<dyn Fn(part, tone, count)>) voice / engine spoken cue and the model reaction at the 10th tap
notice(text) anyone error card in the companion
avatar_command(AvatarCommand) voice transcripts return to frame / perch on a window
show, command(Command::…) second launch, global shortcut Show, Hide, ToggleFocus, Settings(section), Teleport, Return, ResetPosition, AlwaysOnTop, Quit

capri_ui::avatar_command(text) -> Option<AvatarCommand> recognizes the movement commands (English/Russian, ). The companion's own composer checks it before sending; spoken input must check it too and call ui.avatar_command(cmd) instead of submitting the turn.

capri_ui::i18n::{t, tf, set_locale, rtl}: the interface catalogue (assets/i18n/interface-locales.json, 50 locales, English keys, English fallback). Feature pages should label their controls with t("English key").

Settings sections

  • sections.ui = UiSettings (Section::NAME = "ui"): window (always on top, chip, restore on wake, start hidden, startup intro, launch at login), presentation (detached style, reply auto-hide), motion (reduced motion system|on|off, float), glitch, CRT, dimming, teleport effects and sound, drag tether, snap radius, tap gap, interface theme (presets and custom colours). Values are clamped on read. Read it from other crates with store.section::<capri_ui::UiSettings>.
  • language.interface / language.conversation / language.customConversation (core settings), personality (capri_core::persona), communication style.

Pages: a known section id (models, api, knowledge, microphone, voice, calls, music, computer, workflows, user-tools, screen, applications, files, time, updates) takes that slot in Capri's navigation (models shows a placeholder until provided); any other id is listed under "Capabilities". Page titles are searchable.

What the app must wire

  1. One SettingsStore shared by every crate and passed to run.
  2. One UiHandle created before run, cloned into voice / music / timers / sleep / attachments.
  3. Voice transcripts: capri_ui::avatar_command before engine.submit.
  4. i3: a StatusNotifierItem host for the tray (snixembed --fork for i3bar's XEmbed tray, or a bar with SNI support) and a compositor (picom) for transparency. Suggested i3 config: for_window [class="^capri$"] floating enable, sticky enable, border none.

Known limits

  • Teleports and docking use the companion's display only; mixed per-output scales assume KWin logical px = X11 px (true with one global scale).
  • Perched windows are followed by an 1800 ms poll (as Capri's Linux bridge), not KWin signals.
  • Reviewed-pose limb swing, music notes, portrait pan/zoom, core/collapsed presence, subtitle paging, credits epithets and the attachment picker button are not implemented.
  • egui has no bidi shaping: Arabic/Hebrew/Persian/Urdu text renders unshaped and right-aligned.