Linux port: first run, packaging, single instance, privacy and wiring
CI / test (push) Has been cancelled

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>
This commit is contained in:
nocodeandClaude Opus 5.5 committed 2026-11-12 20:21:40 +01:00
1 parent a2abf01280
commit 49349d6ecd
73 files changed
+4834 -517

No files matched your search

+1 -10
View File
@@ -174,16 +174,7 @@ pub fn launch(entry: &AppEntry) -> Result<()> {
use std::os::unix::process::CommandExt;
let (program, args) = entry.exec.split_first().context("The application has no command.")?;
let mut command = Command::new(program);
command.args(args).env_clear().env("PATH", "/usr/local/bin:/usr/bin:/bin").stdin(Stdio::null()).stdout(Stdio::null()).stderr(Stdio::null());
for name in [
"HOME", "USER", "LOGNAME", "LANG", "LC_ALL", "LC_MESSAGES", "DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "XDG_RUNTIME_DIR",
"DBUS_SESSION_BUS_ADDRESS", "XDG_SESSION_TYPE", "XDG_CURRENT_DESKTOP", "DESKTOP_SESSION", "XDG_DATA_DIRS", "XDG_DATA_HOME",
"XDG_CONFIG_HOME", "I3SOCK",
] {
if let Some(value) = std::env::var_os(name) {
command.env(name, value);
}
}
command.args(args).env_clear().envs(capri_core::process::launch_environment()).stdin(Stdio::null()).stdout(Stdio::null()).stderr(Stdio::null());
if let Some(home) = std::env::var_os("HOME") {
command.current_dir(home);
}
+1 -1
View File
@@ -129,7 +129,7 @@ pub(crate) fn full_access(external: &StateProvider) -> bool {
external()["fullComputerAccess"] == true
}
pub(crate) const PAUSED: &str = "Application access is paused. Turn it on from Capri’s toolbar.";
pub(crate) const PAUSED: &str = "Application access is paused. Turn it on in Settings › Applications and files.";
#[cfg(test)]
pub(crate) mod test_support {
+58 -1
View File
@@ -47,6 +47,10 @@ pub trait Player: Send + Sync {
async fn command(&self, method: &str) -> Result<()>;
async fn open_uri(&self, uri: &str) -> Result<()>;
async fn set_volume(&self, volume: f64) -> Result<()>;
/// MPRIS `Seek`: relative offset in microseconds.
async fn seek(&self, offset_us: i64) -> Result<()>;
/// MPRIS `Shuffle` (bool) or `LoopStatus` (`None`, `Track`, `Playlist`).
async fn set_mode(&self, property: &str, value: zbus::zvariant::Value<'static>) -> Result<()>;
}
/// Session-bus MPRIS client, connected on first use.
@@ -109,6 +113,14 @@ impl Player for Mpris {
self.properties().await?.set(zbus::names::InterfaceName::try_from(PLAYER)?, "Volume", value).await?;
Ok(())
}
async fn seek(&self, offset_us: i64) -> Result<()> {
self.connection().await?.call_method(Some(BUS), PATH, Some(PLAYER), "Seek", &(offset_us,)).await?;
Ok(())
}
async fn set_mode(&self, property: &str, value: zbus::zvariant::Value<'static>) -> Result<()> {
self.properties().await?.set(zbus::names::InterfaceName::try_from(PLAYER)?, property, value).await?;
Ok(())
}
}
fn invalid() -> anyhow::Error {
@@ -363,7 +375,33 @@ impl SpotifyTool {
let verify = Duration::from_secs(6).min(self.verify * 2);
Ok(self.wait(verify, |s| s.playing && (!same(s) || !before.playing)).await?.map_or_else(not_verified, done))
}
_ => Ok(fail("unsupported", "This Spotify action is not available on Linux yet. Use play with a Spotify link, transport controls or volume.")),
"seek" => {
if !before.can_seek {
return Ok(fail("unsupported", "Spotify cannot seek in the current track."));
}
let mut target = c["seconds"].as_f64().unwrap_or(0.0) * 1000.0;
if let Some(length) = before.duration_ms {
target = target.min((length - 1000.0).max(0.0));
}
let offset = target - before.position_ms.unwrap_or(0.0);
self.player.seek((offset * 1000.0) as i64).await?;
Ok(self.wait(self.verify, |s| s.position_ms.is_some_and(|p| (p - target).abs() <= 2500.0)).await?.map_or_else(not_verified, done))
}
"shuffle" => {
let on = c["enabled"].as_bool().unwrap_or(false);
self.player.set_mode("Shuffle", on.into()).await?;
Ok(self.wait(self.verify, |s| s.shuffle == Some(on)).await?.map_or_else(not_verified, done))
}
"repeat" => {
let (loop_status, shown) = match c["mode"].as_str().unwrap_or("off") {
"track" => ("Track", "track"),
"context" => ("Playlist", "list"),
_ => ("None", "none"),
};
self.player.set_mode("LoopStatus", loop_status.into()).await?;
Ok(self.wait(self.verify, |s| s.repeat.as_deref() == Some(shown)).await?.map_or_else(not_verified, done))
}
_ => Ok(fail("unsupported", "This Spotify action is not available on Linux yet. Use play with a Spotify link, transport controls, seek, shuffle, repeat or volume.")),
}
}
}
@@ -468,6 +506,22 @@ mod tests {
self.state.lock().as_mut().unwrap().volume = Some(volume);
Ok(())
}
async fn seek(&self, offset_us: i64) -> Result<()> {
let mut state = self.state.lock();
let s = state.as_mut().unwrap();
s.position_ms = Some(s.position_ms.unwrap_or(0.0) + offset_us as f64 / 1000.0);
Ok(())
}
async fn set_mode(&self, property: &str, value: zbus::zvariant::Value<'static>) -> Result<()> {
let mut state = self.state.lock();
let s = state.as_mut().unwrap();
match (property, value) {
("Shuffle", zbus::zvariant::Value::Bool(on)) => s.shuffle = Some(on),
("LoopStatus", zbus::zvariant::Value::Str(mode)) => s.repeat = Some(match mode.as_str() { "Track" => "track", "Playlist" => "list", _ => "none" }.into()),
_ => {}
}
Ok(())
}
}
fn setup(fake: Fake, enabled: bool) -> (tempfile::TempDir, SpotifyTool, Arc<Fake>) {
@@ -508,6 +562,9 @@ mod tests {
assert_eq!(fake.calls.lock().last().unwrap(), "spotify:search:Daft%20Punk%20One%20More%20Time");
assert!(q["data"].get("playback").is_none() && q["confirmation"].as_str().unwrap().contains("not started"));
assert_eq!(call(&tool, json!({"action":"queue"})).await["error"]["code"], "unsupported");
// Seek, shuffle and repeat go through MPRIS and are verified on the player state.
assert_eq!(call(&tool, json!({"action":"shuffle","enabled":true})).await["ok"], true);
assert_eq!(call(&tool, json!({"action":"repeat","mode":"track"})).await["ok"], true);
}
#[tokio::test]
+26 -25
View File
@@ -6,6 +6,7 @@ use serde_json::json;
use crate::files::{Access, INSTALLATION_ID};
use crate::{TimeService, ToolsSettings};
use capri_core::i18n::t;
fn notice(ui: &mut egui::Ui, key: &str, result: anyhow::Result<()>) {
let id = ui.scope_id().with(("capri-tools-notice", key));
@@ -22,31 +23,31 @@ pub fn settings_ui(ui: &mut egui::Ui, store: &Arc<SettingsStore>) {
let mut s: ToolsSettings = store.section();
let before = s.clone();
ui.heading("Application access");
ui.checkbox(&mut s.application_access, "Application access enabled")
.on_hover_text("When off, application, Spotify and trash actions are paused. Individual grants are kept.");
ui.checkbox(&mut s.notepad, "Text editor (Notepad): open it for Capri");
ui.checkbox(&mut s.calculator, "Calculator: precise calculations and opening the calculator");
ui.heading(t("Application access"));
ui.checkbox(&mut s.application_access, t("Application access enabled"))
.on_hover_text(t("When off, application, Spotify and trash actions are paused. Individual grants are kept."));
ui.checkbox(&mut s.notepad, t("Text editor (Notepad): open it for Capri"));
ui.checkbox(&mut s.calculator, t("Calculator: precise calculations and opening the calculator"));
// TODO: plain toggle; Capri asked "Enable Spotify control?" in a modal first. Add it once the UI crate exposes confirmations.
ui.checkbox(&mut s.spotify, "Spotify (BETA): control the Spotify desktop app")
.on_hover_text("Only the Spotify desktop app is controlled, over MPRIS. Named search opens Spotify's own search.");
ui.checkbox(&mut s.spotify, t("Spotify (BETA): control the Spotify desktop app"))
.on_hover_text(t("Only the Spotify desktop app is controlled, over MPRIS. Named search opens Spotify's own search."));
ui.separator();
ui.heading("Timers and reminders");
ui.checkbox(&mut s.wake_on_reminder, "Wake Capri and prepare her voice for reminders");
ui.label("Timers survive model unloading and are restored after restart. Keep Capri running for notifications. Missed reminders appear next time you open Capri.");
ui.heading(t("Timers and reminders"));
ui.checkbox(&mut s.wake_on_reminder, t("Wake Capri and prepare her voice for reminders"));
ui.label(t("Timers survive model unloading and are restored after restart. Keep Capri running for notifications. Missed reminders appear next time you open Capri."));
if s != before {
notice(ui, "apps", store.set_section(&s));
}
ui.separator();
ui.heading("File access");
ui.heading(t("File access"));
file_access(ui, store);
ui.separator();
ui.heading("Internet search");
ui.label("Internet mode is switched per conversation with the globe button. It searches the web for the current request only. Chat history, screenshots and files are not sent automatically. Requests that look like passwords or keys are never sent.");
ui.heading(t("Internet search"));
ui.label(t("Internet mode is switched per conversation with the globe button. It searches the web for the current request only. Chat history, screenshots and files are not sent automatically. Requests that look like passwords or keys are never sent."));
}
fn file_access(ui: &mut egui::Ui, store: &Arc<SettingsStore>) {
@@ -54,10 +55,10 @@ fn file_access(ui: &mut egui::Ui, store: &Arc<SettingsStore>) {
Ok(access) => access,
Err(e) => return notice(ui, "files", Err(e)),
};
ui.label("Capri may read the folders below. \"Allow file changes\" lets her create, replace, move and trash files there; outside the installation folder she asks first.");
ui.label(t("Capri may read the folders below. \"Allow file changes\" lets her create, replace, move and trash files there; outside the installation folder she asks first."));
let scopes = access.scopes();
if scopes.is_empty() {
ui.label("No folders are shared with Capri.");
ui.label(t("No folders are shared with Capri."));
}
let mut result = Ok(());
for scope in scopes {
@@ -65,10 +66,10 @@ fn file_access(ui: &mut egui::Ui, store: &Arc<SettingsStore>) {
let label = if scope.id == INSTALLATION_ID { format!("Capri data ({})", scope.root.display()) } else { scope.root.display().to_string() };
ui.label(label);
let mut write = scope.write;
if ui.checkbox(&mut write, "Allow file changes").changed() {
if ui.checkbox(&mut write, t("Allow file changes")).changed() {
result = access.set_write(&scope.id, write);
}
if ui.button("Revoke folder access").clicked() {
if ui.button(t("Revoke folder access")).clicked() {
result = access.revoke(Some(&scope.id));
}
});
@@ -78,7 +79,7 @@ fn file_access(ui: &mut egui::Ui, store: &Arc<SettingsStore>) {
ui.horizontal(|ui| {
// TODO: typed path instead of the portal folder picker; add rfd/ashpd in the UI crate.
ui.add(egui::TextEdit::singleline(&mut folder).hint_text("/home/you/Documents"));
if ui.button("Choose a folder…").clicked() && !folder.trim().is_empty() {
if ui.button(t("Choose a folder…")).clicked() && !folder.trim().is_empty() {
result = access.grant(std::path::Path::new(folder.trim())).map_err(|_| {
anyhow::anyhow!("This folder cannot be added. Choose a personal folder outside system and Capri application data.")
});
@@ -86,7 +87,7 @@ fn file_access(ui: &mut egui::Ui, store: &Arc<SettingsStore>) {
}
});
ui.data_mut(|d| d.insert_temp(id, folder));
if ui.button("Revoke all access").clicked() {
if ui.button(t("Revoke all access")).clicked() {
result = access.revoke(None);
}
notice(ui, "files", result);
@@ -110,7 +111,7 @@ pub fn timers_ui(ui: &mut egui::Ui, time: &TimeService) {
ui.add(egui::DragValue::new(&mut sec).range(0..=59).suffix(" s"));
});
});
if ui.button("Start").clicked() {
if ui.button(t("Start")).clicked() {
let action = ["remind", "timer", "stopwatch"][kind];
let seconds = (h * 3600 + m * 60 + sec).min(366 * 86400);
let mut args = json!({"action": action, "title": title});
@@ -123,7 +124,7 @@ pub fn timers_ui(ui: &mut egui::Ui, time: &TimeService) {
ui.separator();
let objects: Vec<_> = time.snapshot().into_iter().filter(|o| o["state"] != "cancelled" && o["state"] != "acknowledged").take(100).collect();
if objects.is_empty() {
ui.label("No active timers or reminders.");
ui.label(t("No active timers or reminders."));
}
for o in objects {
let (oid, state, kind) = (o["id"].as_str().unwrap_or(""), o["state"].as_str().unwrap_or(""), o["kind"].as_str().unwrap_or(""));
@@ -136,16 +137,16 @@ pub fn timers_ui(ui: &mut egui::Ui, time: &TimeService) {
};
ui.horizontal(|ui| {
ui.label(format!("{label} · {status} · {:02}:{:02}:{:02}", shown / 3600, shown / 60 % 60, shown % 60));
if kind != "reminder" && state == "running" && ui.button("Pause").clicked() {
if kind != "reminder" && state == "running" && ui.button(t("Pause")).clicked() {
result = run(json!({"action": "pause", "id": oid}));
}
if state == "paused" && ui.button("Resume").clicked() {
if state == "paused" && ui.button(t("Resume")).clicked() {
result = run(json!({"action": "resume", "id": oid}));
}
if state == "due" && kind != "stopwatch" && ui.button("Snooze 5 minutes").clicked() {
if state == "due" && kind != "stopwatch" && ui.button(t("Snooze 5 minutes")).clicked() {
result = run(json!({"action": "snooze", "id": oid}));
}
if ui.button("Dismiss").clicked() {
if ui.button(t("Dismiss")).clicked() {
result = run(json!({"action": "cancel", "id": oid}));
}
});
+1
View File
@@ -440,6 +440,7 @@ mod tests {
#[test]
fn sensitive_queries_and_public_urls() {
// release-check: allow (synthetic credential shapes for the refusal test)
for q in ["my key sk-abcdefgh1234", "password: hunter22", "Bearer abcdefgh12345", "https://u:p@host.com", "-----BEGIN RSA PRIVATE KEY-----"] {
assert!(sensitive_query(q), "{q}");
}