Skip to content

A lightweight, macOS-style dock for Windows 11, with glass visuals, smooth magnification, and Genie effect.

feat: add OpenCode Zen local cost tracking and improve usage reporting

CristianOlivera1859f14e979dc
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 43a63c9..c212e2e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,29 @@ copia la sección de la versión que se publica a la release de GitHub.
### English
+- Added a persistent red attention badge for apps that request attention through
+ Windows, including grouped apps and minimized-window thumbnails (issue #22,
+ first stage). It clears on window activation/closure and follows Windows' badge
+ preference live. Updates reuse visuals without rebuilding the dock, additional
+ polling, notification-content access, or invented unread-message counts.
+- Fixed (issue #25): an uninstalled app could stay in Recent Apps with no way
+ to remove it. Recent apps that no longer exist now leave the dock on their
+ own, as pinned ones already did, and clicking one that was just uninstalled
+ removes it instead of failing. A recent app's menu also has "Remove from
+ Dock", to dismiss it while recent apps stay on; it comes back the next time
+ you open and close it.
+- Fixed: a Logitech mouse on a receiver (reported with a G305 on its LIGHTSPEED
+ receiver) did not show its battery in the menu bar, or showed it only for a
+ moment. The mouse sleeps a few seconds after it stops moving and then does not
+ answer, and every check dropped it. A device behind a receiver now keeps its
+ last reading for 30 minutes while it sleeps, as Logitech's own tools do, and
+ each request waits longer for a reply over the radio. Unplugging the
+ receiver still removes it at once.
+- OpenCode now distinguishes Go quotas from Zen's estimated cost on this device
+ over the last 30 days. Both appear in one theme-aware card; Go also shows its
+ monthly window. Zen opens the official Console for the real account balance,
+ which is not exposed by its public API. Local history is read only, bounded,
+ and refreshed by the existing worker without extra background polling.
- Fixed OpenCode Go account discovery: read its `opencode-go` credential, respect
`XDG_DATA_HOME`, and fall back from an empty environment key to the saved login.
The usage card now identifies Go explicitly and provides a working connection
@@ -28,6 +51,24 @@ copia la sección de la versión que se publica a la release de GitHub.
### Español
+- Añadido un badge rojo persistente para las apps que solicitan atención mediante
+ Windows, también en grupos y miniaturas minimizadas (issue #22, primera etapa).
+ Se quita al activar/cerrar la ventana y sigue en caliente la preferencia de
+ badges de Windows. Se reutilizan los visuales sin reconstruir el dock, sin
+ sondeos adicionales, sin leer mensajes y sin inventar contadores de no leídos.
+- Corregido (issue #25): una app desinstalada podía quedarse en Apps recientes
+ sin forma de quitarla. Las apps recientes que ya no existen salen solas del
+ dock, como ya pasaba con las fijadas, y al hacer clic en una recién
+ desinstalada se quita en vez de fallar. El menú de una app reciente tiene
+ además «Quitar del Dock» para descartarla sin desactivar las recientes;
+ vuelve la próxima vez que la abras y la cierres.
+- Corregido: un ratón Logitech con receptor (reportado con un G305 y su receptor
+ LIGHTSPEED) no mostraba su batería en la barra superior, o solo un momento. El
+ ratón se duerme a los pocos segundos de no moverlo y entonces no responde, y
+ cada comprobación lo quitaba. Un dispositivo tras receptor conserva ahora su
+ última lectura 30 minutos mientras duerme, como las herramientas de Logitech, y
+ cada petición espera más la respuesta por radio. Quitar el
+ receptor lo sigue borrando al instante.
- Corregido un diálogo de error bloqueante ("No se encuentra el ordinal 381") al abrir
aplicaciones con Uninstall Tool (`utshellext.dll`) u otras extensiones del shell de
terceros instaladas (issue #23). `muelle.exe` ahora incrusta un manifiesto de aplicación
@@ -49,6 +90,11 @@ copia la sección de la versión que se publica a la release de GitHub.
se respeta `XDG_DATA_HOME` y una variable de clave vacía permite usar la sesión
guardada. La tarjeta identifica Go e incluye un botón funcional con instrucciones
de conexión, en lugar de un texto de inicio de sesión sin acción.
+- OpenCode distingue las cuotas de Go del gasto estimado de Zen en este equipo
+ durante los últimos 30 días, en una misma tarjeta que respeta el tema. Go muestra
+ también su ventana mensual. Zen permite abrir la consola oficial para consultar
+ el saldo real, que no expone su API pública. El historial se lee sin modificarlo,
+ con límites de trabajo y usando el worker e intervalo existentes.
- Los manifiestos de WinGet usan `/S` en ambos modos desatendidos y declaran
las dependencias de Visual C++ x64 y WebView2. Se corrigen riesgos de interfaz
en la primera instalación y de runtimes ausentes; falta revalidar con Microsoft.
diff --git a/Cargo.lock b/Cargo.lock
index bfc2f31..f5a2654 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -242,12 +242,6 @@ version = "0.21.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
-[[package]]
-name = "base64"
-version = "0.22.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
-
[[package]]
name = "base64"
version = "0.23.1"
@@ -1032,6 +1026,18 @@ dependencies = [
"pin-project-lite",
]
+[[package]]
+name = "fallible-iterator"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649"
+
+[[package]]
+name = "fallible-streaming-iterator"
+version = "0.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
+
[[package]]
name = "fastrand"
version = "2.5.0"
@@ -2123,6 +2129,17 @@ dependencies = [
"libc",
]
+[[package]]
+name = "libsqlite3-sys"
+version = "0.40.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b06e69070b7e12262b0cd90832f0a7396f142a2b330181255562decf9f0c6215"
+dependencies = [
+ "cc",
+ "pkg-config",
+ "vcpkg",
+]
+
[[package]]
name = "linux-raw-sys"
version = "0.12.1"
@@ -2262,13 +2279,13 @@ name = "muelle"
version = "0.1.17"
dependencies = [
"anyhow",
- "base64 0.22.1",
"chrono",
"muelle-config",
"muelle-core",
"muelle-shell",
"png",
"reqwest",
+ "rusqlite",
"serde",
"serde_json",
"windows",
@@ -3221,6 +3238,19 @@ dependencies = [
"windows-sys 0.52.0",
]
+[[package]]
+name = "rusqlite"
+version = "0.43.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f172c4812a19b26d1c23cdb0070e69db335503dfa378b910eb857386e5b8beba"
+dependencies = [
+ "bitflags 2.13.2",
+ "fallible-iterator",
+ "fallible-streaming-iterator",
+ "libsqlite3-sys",
+ "smallvec",
+]
+
[[package]]
name = "rustc-hash"
version = "2.1.3"
@@ -4743,6 +4773,12 @@ dependencies = [
"wasm-bindgen",
]
+[[package]]
+name = "vcpkg"
+version = "0.2.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
+
[[package]]
name = "version-compare"
version = "0.2.1"
diff --git a/README.es.md b/README.es.md
index 889e66f..fb07616 100644
--- a/README.es.md
+++ b/README.es.md
@@ -56,7 +56,7 @@ dibujar su animación; las devuelve al cerrarse.
administrador, sin asistente, en unos dos segundos.
2. Muelle es nuevo, así que SmartScreen puede no reconocerlo todavía y decir que
protegió tu PC. Elige **Más información → Ejecutar de todas formas**. Ver la
- [política de firma de código](https://muellee.vercel.app/code-signing-policy).
+ [política de firma de código](https://muelle.crafter.run/code-signing-policy).
3. Aparece el dock y se oculta la barra de tareas de Windows. Desde entonces Muelle
se abre al iniciar Windows; puedes desactivarlo en Ajustes → Sistema.
@@ -152,4 +152,4 @@ dos tipos de conexión de red, ambas opcionales:
permanecen en memoria; Muelle no las guarda. Se desactiva en Ajustes → Barra
superior → *Mostrar uso de proveedores de IA*.
-Detalles: [muellee.vercel.app/privacy](https://muellee.vercel.app/privacy).
+Detalles: [muelle.crafter.run/privacy](https://muelle.crafter.run/privacy).
diff --git a/README.fr.md b/README.fr.md
index 991655b..bc1c28a 100644
--- a/README.fr.md
+++ b/README.fr.md
@@ -77,7 +77,7 @@ une version dans les [Releases](https://github.com/crafter-station/Muelle/releas
2. Muelle est récent : SmartScreen peut ne pas encore le reconnaître et
indiquer qu'il a protégé votre ordinateur. Choisissez **Informations
complémentaires → Exécuter quand même**. Voir la
- [politique de signature du code](https://muellee.vercel.app/code-signing-policy).
+ [politique de signature du code](https://muelle.crafter.run/code-signing-policy).
3. Ouvrez **Muelle** depuis le menu Démarrer, puis choisissez **Dock** pour
personnaliser le dock et la barre de menus.
@@ -171,4 +171,4 @@ au projet. Il fait deux sortes de requêtes réseau, toutes deux facultatives :
Désactivez-la dans Réglages → Barre de menus → *Afficher l'utilisation des
fournisseurs d'IA*.
-Détails : [muellee.vercel.app/privacy](https://muellee.vercel.app/privacy).
+Détails : [muelle.crafter.run/privacy](https://muelle.crafter.run/privacy).
diff --git a/README.md b/README.md
index 09f5470..50cc841 100644
--- a/README.md
+++ b/README.md
@@ -64,7 +64,7 @@ restored when Muelle exits.
rights, no wizard, about two seconds.
2. Muelle is new, so Windows SmartScreen may not recognize it yet and say it
protected your PC. Choose **More info → Run anyway**. See the
- [code-signing policy](https://muellee.vercel.app/code-signing-policy).
+ [code-signing policy](https://muelle.crafter.run/code-signing-policy).
3. Open **Muelle** from the Start menu, then choose **Dock** to
personalize the dock and top menu bar.
@@ -154,4 +154,4 @@ project. It makes two kinds of network requests, both optional:
in memory and are never stored by Muelle. Turn it off in Settings → Menu bar
→ *Show AI provider usage*.
-Details: [muellee.vercel.app/privacy](https://muellee.vercel.app/privacy).
+Details: [muelle.crafter.run/privacy](https://muelle.crafter.run/privacy).
diff --git a/apps/dock/ACCESSORIES.md b/apps/dock/ACCESSORIES.md
index 6e45e3b..9772a05 100644
--- a/apps/dock/ACCESSORIES.md
+++ b/apps/dock/ACCESSORIES.md
@@ -87,6 +87,15 @@ que devuelve el dispositivo, incluidos sus posibles saltos de nivel; no se
interpolan pasos ni voltajes. En 1000, cero significa desconocido; el cero válido
de 1004 con capacidad SoC sigue mostrándose como 0 %.
+Segunda corrección (2026-11-20, el G305 seguía sin verse). El protocolo era
+correcto: Solaar muestra el G305 (C53F, PID inalámbrico 4074) con
+`BATTERY STATUS {1000}` y «Battery: 90%, discharging» (issues #850 y #792). Lo que
+fallaba era el ciclo: el G305 duerme a los pocos segundos sin moverse y entonces no
+contesta por radio. Cada consulta reemplazaba la lista, así que el ratón
+desaparecía en casi todas las consultas (y con cualquier error). Ahora se conserva
+la lectura de los slots de receptor durante 30 minutos y la petición HID++ espera
+400 ms en lugar de 150 ms.
+
Windows separa los informes HID++ de 7 y 20 bytes. Se descubren ambas colecciones
FF00:0001/0002, se agrupan por instancia USB e interfaz y se consultan en un solo
proceso. Antes de escribir se validan VID/PID, usage y tamaños de cada handle.
@@ -143,10 +152,14 @@ carga, suspensión y convivencia con G HUB, GG y NGENUITY.
- Pausa mientras la barra esté auto-oculta o cubierta. Dos eventos de kernel comunican
visibilidad; no hay un timer de UI ni escrituras bloqueantes a una tubería.
- Cada consulta corre en otro `muelle.exe --accessory-usb-query`, con Job Object y
- plazo de dos segundos. HID usa I/O overlapped, presupuestos de 150 ms por intercambio
- y 1.250 ms para la secuencia. Si un controlador no cancela, solo se termina ese hijo;
+ plazo de dos segundos. HID usa I/O overlapped, 150 ms por intercambio con auriculares,
+ 400 ms por petición HID++ a través de receptor (la radio despierta antes al ratón;
+ el monitor de referencia usa 400 ms en su ping) y 1.250 ms para la secuencia. Si un controlador no cancela, solo se termina ese hijo;
el coordinador Bluetooth no espera la consulta.
-- Ante errores: se retira su lectura y la espera crece desde dos hasta quince minutos.
+- Ante errores: la espera crece desde dos hasta quince minutos. Un auricular directo
+ que no responde se retira; un dispositivo tras receptor (slot 1–6) que no responde,
+ porque duerme o la consulta falló, conserva su última lectura 30 minutos, como el
+ monitor de referencia (`graceSec = 1800`). Quitar el receptor la borra al instante.
Los cambios de metadatos no reinician el plazo. Reanudación o cambio de salida de
audio reconstruyen el lector; no se registra la identidad del periférico en logs.
diff --git a/apps/dock/Cargo.toml b/apps/dock/Cargo.toml
index 00cd797..29347c6 100644
--- a/apps/dock/Cargo.toml
+++ b/apps/dock/Cargo.toml
@@ -21,6 +21,7 @@ muelle-core.workspace = true
muelle-shell.workspace = true
png = "0.18"
reqwest = { version = "0.13", default-features = false, features = ["blocking", "rustls", "system-proxy"] }
+rusqlite = { version = "0.43", default-features = false, features = ["bundled", "hooks", "limits"] }
serde.workspace = true
serde_json = "1"
windows-core.workspace = true
diff --git a/apps/dock/src/accessories/usb/io.rs b/apps/dock/src/accessories/usb/io.rs
index c7dadb0..d5d6735 100644
--- a/apps/dock/src/accessories/usb/io.rs
+++ b/apps/dock/src/accessories/usb/io.rs
@@ -280,6 +280,12 @@ impl Drop for PendingRead<'_> {
}
}
+/// How long one HID++ request through a receiver may wait for its reply.
+/// The radio wakes a mouse in power saving first (a G305 spends most of its
+/// time there), which takes longer than a wired reply; the reference monitor
+/// waits 400 ms for its ping. The query's total budget is unchanged.
+const HIDPP_REPLY: Duration = Duration::from_millis(400);
+
struct LogitechWire {
collections: Vec<Hid>,
until: Instant,
@@ -301,7 +307,7 @@ impl Wire for LogitechWire {
}
let mut packet = request[..output.output].to_vec();
packet[0] = if output.output == 7 { 0x10 } else { 0x11 };
- let end = self.until.min(Instant::now() + Duration::from_millis(150));
+ let end = self.until.min(Instant::now() + HIDPP_REPLY);
let mut reads = self
.collections
.iter()
diff --git a/apps/dock/src/accessories/usb/mod.rs b/apps/dock/src/accessories/usb/mod.rs
index 7aa5bab..679a6d9 100644
--- a/apps/dock/src/accessories/usb/mod.rs
+++ b/apps/dock/src/accessories/usb/mod.rs
@@ -31,6 +31,12 @@ use windows::{
pub const FLAG: &str = "--accessory-usb-query";
const INTERVAL: Duration = Duration::from_secs(60);
const LIMIT: usize = 8;
+/// A device behind a receiver stops answering while it sleeps: a G305 does
+/// after a few seconds without movement, which is most of the time someone
+/// types. Its last reading stays this long, as the reference monitor does
+/// (`graceSec = 1800` for receiver devices), so the indicator does not come
+/// and go with every query. Unplugging the receiver still clears it at once.
+const RECEIVER_GRACE: Duration = Duration::from_secs(30 * 60);
#[derive(Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
struct Request {
@@ -162,7 +168,13 @@ struct Entry {
generation: u64,
next: Instant,
failures: u8,
- devices: Vec<Device>,
+ devices: Vec<Held>,
+}
+/// One device's last reading and when its receiver last reported it.
+struct Held {
+ slot: u8,
+ seen: Instant,
+ device: Device,
}
#[derive(Default)]
pub struct Sources {
@@ -297,36 +309,54 @@ impl Sources {
else {
return;
};
- entry.devices.clear();
+ let now = Instant::now();
+ let previous = std::mem::take(&mut entry.devices);
match response.result {
Ok(readings) => {
entry.failures = 0;
entry.devices = readings
.into_iter()
- .map(|reading| Device {
- id: if reading.slot == 0 {
- entry.id.clone()
- } else {
- format!("{}/{}", entry.id, reading.slot)
- },
- name: if reading.kind == Kind::Mouse {
- "Logitech HID++".into()
- } else {
- "Wireless headset".into()
+ .map(|reading| Held {
+ slot: reading.slot,
+ seen: now,
+ device: Device {
+ id: if reading.slot == 0 {
+ entry.id.clone()
+ } else {
+ format!("{}/{}", entry.id, reading.slot)
+ },
+ name: if reading.kind == Kind::Mouse {
+ "Logitech HID++".into()
+ } else {
+ "Wireless headset".into()
+ },
+ kind: reading.kind,
+ percent: reading.percent,
+ conflicting: false,
+ active_audio: false,
},
- kind: reading.kind,
- percent: reading.percent,
- conflicting: false,
- active_audio: false,
})
.collect();
}
Err(_) => entry.failures = entry.failures.saturating_add(1),
}
- entry.next = Instant::now() + retry_delay(entry.failures);
+ // Receiver slots that did not answer this time (asleep, or a query
+ // that failed) keep their last reading for a while. Slot 0 is a
+ // headset on its own cable or dongle: silent means gone.
+ for held in previous {
+ if held.slot != 0
+ && now.saturating_duration_since(held.seen) < RECEIVER_GRACE
+ && !entry.devices.iter().any(|fresh| fresh.slot == held.slot)
+ {
+ entry.devices.push(held);
+ }
+ }
+ entry.next = now + retry_delay(entry.failures);
}
pub fn devices(&self) -> impl Iterator<Item = &Device> {
- self.entries.values().flat_map(|entry| &entry.devices)
+ self.entries
+ .values()
+ .flat_map(|entry| entry.devices.iter().map(|held| &held.device))
}
}
fn retry_delay(failures: u8) -> Duration {
@@ -418,6 +448,49 @@ mod tests {
assert!(sources.deadline().is_none());
}
+ #[test]
+ fn a_sleeping_receiver_device_keeps_its_last_reading_for_a_while() {
+ let path = r"\\?\hid#vid_046d&pid_c53f&mi_02&col02#7&12345678&0&0001#{hid-guid}";
+ let mut sources = Sources::default();
+ sources.add(path.into(), "g305".into());
+ let key = protocol::receiver_key(path).unwrap_or_default();
+ let generation = sources.entries[&key].generation;
+ let mouse = Reading {
+ slot: 1,
+ kind: Kind::Mouse,
+ percent: Some(90),
+ };
+ let done = |result| Completed {
+ path: key.clone(),
+ generation,
+ result,
+ };
+ sources.complete(done(Ok(vec![mouse.clone()])));
+ // Asleep: the receiver answers, the mouse does not.
+ sources.complete(done(Ok(Vec::new())));
+ assert_eq!(sources.devices().next().and_then(|d| d.percent), Some(90));
+ // A failed query does not drop it either.
+ sources.complete(done(Err(anyhow::anyhow!("timeout"))));
+ assert_eq!(sources.devices().count(), 1);
+ // A fresh reading replaces it, never duplicates it.
+ sources.complete(done(Ok(vec![Reading {
+ percent: Some(85),
+ ..mouse
+ }])));
+ assert_eq!(sources.devices().count(), 1);
+ assert_eq!(sources.devices().next().and_then(|d| d.percent), Some(85));
+ // Past the grace period it is gone.
+ if let Some(entry) = sources.entries.get_mut(&key) {
+ for held in &mut entry.devices {
+ held.seen = Instant::now()
+ .checked_sub(RECEIVER_GRACE + Duration::from_secs(1))
+ .unwrap_or(held.seen);
+ }
+ }
+ sources.complete(done(Ok(Vec::new())));
+ assert_eq!(sources.devices().count(), 0);
+ }
+
#[test]
#[ignore = "Native fixture, run only as the child of the deadline test"]
fn stalled_usb_fixture() {
diff --git a/apps/dock/src/app.rs b/apps/dock/src/app.rs
index b011eb5..85c0965 100644
--- a/apps/dock/src/app.rs
+++ b/apps/dock/src/app.rs
@@ -24,6 +24,7 @@ use std::{
use anyhow::{Context, Result};
use muelle_config::{Config, DockGroup};
use muelle_core::{
+ attention::Attention,
bounce,
layout::{ItemKind, Layout, Metrics, Rect, layout},
magnify::{Magnifier, magnify},
@@ -113,6 +114,7 @@ const WM_MOUSELEAVE: u32 = 0x02A3;
const HSHELL_WINDOWACTIVATED: usize = 4;
const HSHELL_RUDEAPPACTIVATED: usize = 0x8004;
const HSHELL_FLASH: usize = 0x8006;
+const HSHELL_WINDOWDESTROYED: usize = 2;
/// A window's title or icon changed.
const HSHELL_REDRAW: usize = 6;
/// The keyboard language changed.
@@ -144,6 +146,7 @@ const PINS_CHANGED: u32 = WM_APP + 7;
const ASSETS_READY: u32 = WM_APP + 8;
/// The guard also checks graphics health while the scene is otherwise idle.
pub(crate) const HEALTH_CHECK: u32 = WM_APP + 9;
+const TASKBAR_PREFS_CHANGED: u32 = WM_APP + 10;
/// Magnification range, in icons on either side of the cursor.
const RANGE_IN_ICONS: f32 = 3.0;
@@ -271,6 +274,7 @@ const CMD_TASK_MANAGER: u32 = 13;
const CMD_TASKBAR_SETTINGS: u32 = 14;
const CMD_UNGROUP: u32 = 15;
const CMD_REMOVE_FOLDER: u32 = 16;
+const CMD_FORGET_RECENT: u32 = 17;
const CMD_WINDOW: u32 = 100;
const MENU_WINDOWS: usize = 12;
const MENU_TITLE_CHARS: usize = 60;
@@ -338,6 +342,43 @@ struct Entry {
members: Vec<String>,
}
+fn app_has_attention(attention: &Attention, windows: &[TrackedWindow], id: &str) -> bool {
+ windows
+ .iter()
+ .any(|window| window.app_id == id && attention.contains(window.hwnd))
+}
+
+fn entry_has_attention(attention: &Attention, windows: &[TrackedWindow], entry: &Entry) -> bool {
+ match entry.role {
+ Role::App => entry
+ .id
+ .as_deref()
+ .is_some_and(|id| app_has_attention(attention, windows, id)),
+ Role::Group => entry
+ .members
+ .iter()
+ .any(|id| app_has_attention(attention, windows, id)),
+ Role::Window => entry
+ .id
+ .as_deref()
+ .and_then(window_of)
+ .is_some_and(|hwnd| attention.contains(hwnd)),
+ _ => false,
+ }
+}
+
+fn active_attention_window(windows: &[TrackedWindow], foreground: isize) -> isize {
+ // Windows may briefly report its last minimized window as foreground.
+ if windows
+ .iter()
+ .any(|window| window.hwnd == foreground && !window.minimized)
+ {
+ foreground
+ } else {
+ 0
+ }
+}
+
#[derive(Clone, Copy, PartialEq, Eq)]
enum Role {
App,
@@ -644,6 +685,9 @@ struct App {
_saver_watch: power::SaverWatch,
/// Hears pins and unpins on the Windows taskbar.
pin_watch: Option<muelle_shell::watch::RegistryWatch>,
+ badge_watch: Option<muelle_shell::watch::RegistryWatch>,
+ attention: Attention,
+ attention_enabled: bool,
assets: HashMap<String, Asset>,
/// Scale, theme and icon pixel size the cached assets were drawn for.
assets_for: (f32, bool, u32),
@@ -1329,6 +1373,7 @@ impl App {
layout: dock,
};
self.stage = Some(stage);
+ self.sync_attention_visuals()?;
self.place_windows()?;
self.schedule_trim();
self.render()?;
@@ -2981,7 +3026,17 @@ impl App {
Outside::Open(id)
});
}
- if windows.is_empty() {
+ if windows.is_empty() && !app_exists(&id) {
+ // Uninstalled while the dock was running: it leaves the dock
+ // instead of failing to open.
+ if self.prune_missing_apps() {
+ save_settings(&self.roster, &self.config);
+ if let Err(error) = self.refresh() {
+ muelle_shell::log::line(&format!("app desinstalada: {error:#}"));
+ }
+ }
+ None
+ } else if windows.is_empty() {
self.start_bounce(id.clone(), None);
Some(Outside::Open(id))
} else if group_is_foreground(&windows, tracker::foreground_window()) {
@@ -3039,6 +3094,7 @@ impl App {
dock: self.input,
},
)?);
+ self.sync_attention_visuals()?;
self.render()
}
@@ -3312,6 +3368,10 @@ impl App {
enabled: true,
});
}
+ // A recent app can be dismissed while recent apps stay on.
+ if windows.is_empty() && self.roster.recent().iter().any(|recent| recent == id) {
+ items.push(MenuItem::action(CMD_FORGET_RECENT, t.remove_from_dock));
+ }
if is_file {
items.push(MenuItem::action(CMD_RUN_AS_ADMIN, t.run_as_admin));
items.push(MenuItem::action(CMD_REVEAL, t.show_in_explorer));
@@ -3391,6 +3451,13 @@ impl App {
None
}
CMD_SETTINGS => Some(Outside::OpenSettings),
+ CMD_FORGET_RECENT => {
+ if self.roster.forget_recent(&id) {
+ save_settings(&self.roster, &self.config);
+ self.refresh()?;
+ }
+ None
+ }
CMD_REMOVE_FOLDER => {
if let Err(error) = forget_shortcuts_folder(&self.config) {
eprintln!("muelle: {error}");
@@ -3493,7 +3560,7 @@ impl App {
/// unpinned there is unpinned here. Apps pinned only in the dock stay.
/// Windows offers no way to do the reverse (pin to the taskbar).
fn sync_taskbar_pins(&mut self) -> Result<()> {
- let pruned = self.prune_missing_pins();
+ let pruned = self.prune_missing_apps();
let Some(current) = taskbar_pins_if_readable() else {
if pruned {
save_settings(&self.roster, &self.config);
@@ -3532,10 +3599,10 @@ impl App {
self.refresh()
}
- /// Unpins apps that were uninstalled, so no broken icon stays behind, as
- /// the Windows taskbar drops them; apps in groups too. Returns whether
- /// anything changed.
- fn prune_missing_pins(&mut self) -> bool {
+ /// Removes apps that were uninstalled, so no broken icon stays behind, as
+ /// the Windows taskbar drops them: pinned apps (in groups too) and recent
+ /// apps (issue #25). Returns whether anything changed.
+ fn prune_missing_apps(&mut self) -> bool {
let missing: Vec<String> = self
.roster
.pinned_apps()
@@ -3545,7 +3612,17 @@ impl App {
for id in &missing {
self.roster.unpin(id);
}
- !missing.is_empty()
+ let gone: Vec<String> = self
+ .roster
+ .recent()
+ .iter()
+ .filter(|id| !app_exists(id))
+ .cloned()
+ .collect();
+ for id in &gone {
+ self.roster.forget_recent(id);
+ }
+ !missing.is_empty() || !gone.is_empty()
}
fn toggle_hiding(&mut self) -> Result<()> {
@@ -3579,21 +3656,83 @@ impl App {
self.last_frame = Instant::now();
}
- fn on_attention(&mut self, hwnd: isize) {
- if hwnd == tracker::foreground_window() {
- return;
+ fn on_attention(&mut self, hwnd: isize) -> Result<()> {
+ if !self.windows.iter().any(|window| window.hwnd == hwnd) && self.read_windows() {
+ self.sync_attention_visuals()?;
+ self.render()?;
+ }
+ // A minimize/flash can arrive before the debounced tracker refresh.
+ // SAFETY: Read-only query; a stale or destroyed HWND returns false.
+ let minimized =
+ unsafe { windows::Win32::UI::WindowsAndMessaging::IsIconic(HWND(hwnd as *mut _)) }
+ .as_bool();
+ let foreground = if minimized {
+ 0
+ } else {
+ active_attention_window(&self.windows, tracker::foreground_window())
+ };
+ if hwnd == foreground {
+ return Ok(());
}
if let Some(window) = self.windows.iter().find(|window| window.hwnd == hwnd) {
- self.start_bounce(
- window.app_id.clone(),
- Some(ATTENTION_HOPS * bounce::HOP_SECONDS),
- );
+ let changed = self.attention_enabled && self.attention.request(hwnd, foreground);
+ if changed || !self.attention_enabled {
+ self.start_bounce(
+ window.app_id.clone(),
+ Some(ATTENTION_HOPS * bounce::HOP_SECONDS),
+ );
+ }
+ if changed {
+ self.sync_attention_visuals()?;
+ self.render()?;
+ }
+ }
+ Ok(())
+ }
+
+ fn sync_attention_visuals(&mut self) -> Result<()> {
+ if let Some(stage) = &mut self.stage {
+ stage.scene.set_attention(
+ &self.gfx,
+ self.entries.iter().map(|entry| {
+ self.attention_enabled
+ && entry_has_attention(&self.attention, &self.windows, entry)
+ }),
+ )?;
}
+ if let Some(view) = &mut self.group_view {
+ view.set_attention(&self.gfx, |id| {
+ self.attention_enabled && app_has_attention(&self.attention, &self.windows, id)
+ })?;
+ }
+ Ok(())
+ }
+
+ fn taskbar_preferences_changed(&mut self) -> Result<()> {
+ if let Some(watch) = &mut self.badge_watch {
+ watch.arm();
+ }
+ let enabled = status::taskbar_badges_enabled();
+ if self.attention_enabled != enabled {
+ self.attention_enabled = enabled;
+ self.attention.clear();
+ self.sync_attention_visuals()?;
+ self.render()?;
+ }
+ Ok(())
+ }
+
+ fn forget_attention(&mut self, hwnd: isize) -> Result<()> {
+ if self.attention.acknowledge(hwnd) {
+ self.sync_attention_visuals()?;
+ self.render()?;
+ }
+ Ok(())
}
/// Refreshes open windows and recomposes the dock if anything changed.
fn sync(&mut self) -> Result<()> {
- self.read_windows();
+ let attention_changed = self.read_windows();
if self
.preview
.as_ref()
@@ -3661,6 +3800,10 @@ impl App {
self.start_flights(&newly_minimized);
}
self.started = true;
+ if attention_changed {
+ self.sync_attention_visuals()?;
+ self.render()?;
+ }
// A foreground-window change may mean an app entered or exited full-screen mode.
self.update_fullscreen()
}
@@ -4078,15 +4221,27 @@ impl App {
// The app roster can stay identical while its windows change z-order.
// Refresh their order so the next dock activation selects the actual
// most recently used window rather than a stale group leader.
- self.read_windows();
+ let attention_changed = self.read_windows();
#[cfg(feature = "recover-browser-z-order")]
tracker::recover_browser_z_order(&self.windows, foreground);
- self.update_fullscreen()
+ self.update_fullscreen()?;
+ if attention_changed {
+ self.sync_attention_visuals()?;
+ self.render()?;
+ }
+ Ok(())
}
- fn read_windows(&mut self) {
+ fn read_windows(&mut self) -> bool {
self.windows = self.tracker.list();
self.preview_order.update(&self.windows);
+ let pruned = self
+ .attention
+ .retain(|hwnd| self.windows.iter().any(|window| window.hwnd == hwnd));
+ self.attention.acknowledge(active_attention_window(
+ &self.windows,
+ tracker::foreground_window(),
+ )) || pruned
}
fn on_appbar_notice(&mut self, notice: usize) -> Result<()> {
@@ -4624,6 +4779,9 @@ unsafe extern "system" fn wndproc(hwnd: HWND, msg: u32, w: WPARAM, l: LPARAM) ->
DROP_RUN => with_app_then("soltar archivos", |app| Ok(app.pending_drop.take())),
WM_RBUTTONUP => with_app_then("menú", App::on_right_click),
BIN_STATE => with_app("papelera", |app| app.set_bin_full(w.0 != 0)),
+ TASKBAR_PREFS_CHANGED => {
+ with_app("preferencias de badges", App::taskbar_preferences_changed)
+ }
BIN_CHANGED => {
// SAFETY: `hwnd` is this live window on its owning UI thread.
unsafe { SetTimer(Some(hwnd), BIN_TIMER, BIN_DELAY_MS, None) };
@@ -4781,10 +4939,9 @@ unsafe extern "system" fn wndproc(hwnd: HWND, msg: u32, w: WPARAM, l: LPARAM) ->
HSHELL_LANGUAGE => menu_bar_refresh(),
code => {
if code == HSHELL_FLASH {
- with_app("aviso de atención", |app| {
- app.on_attention(l.0);
- Ok(())
- });
+ with_app("aviso de atención", |app| app.on_attention(l.0));
+ } else if code == HSHELL_WINDOWDESTROYED {
+ with_app("ventana cerrada", |app| app.forget_attention(l.0));
}
// SAFETY: `hwnd` is this live window on its owning UI thread.
unsafe { SetTimer(Some(hwnd), SYNC_TIMER, SYNC_DELAY_MS, None) };
@@ -4936,6 +5093,9 @@ pub fn run() -> Result<()> {
_bin_watch: BinWatch::register(input, BIN_CHANGED),
_saver_watch: power::SaverWatch::new(input.0 as isize),
pin_watch: muelle_shell::pins::watch(visual.0 as isize, PINS_CHANGED),
+ badge_watch: status::watch_taskbar_settings(visual.0 as isize, TASKBAR_PREFS_CHANGED),
+ attention: Attention::default(),
+ attention_enabled: status::taskbar_badges_enabled(),
assets: HashMap::new(),
assets_for: (0.0, false, 0),
placeholder: None,
@@ -4996,7 +5156,7 @@ pub fn run() -> Result<()> {
let _ = SetConsoleCtrlHandler(Some(on_console_ctrl), true);
// Apps uninstalled while Muelle was closed leave the dock.
- if app.prune_missing_pins() {
+ if app.prune_missing_apps() {
save_settings(&app.roster, &app.config);
}
// Pins and unpins made on the Windows taskbar while Muelle was closed.
@@ -5099,6 +5259,150 @@ pub fn run() -> Result<()> {
Ok(())
}
+#[cfg(test)]
+mod attention_tests {
+ use super::*;
+
+ #[test]
+ fn attention_reaches_apps_groups_and_minimized_thumbnails_without_clearing_other_windows() {
+ let windows = [
+ TrackedWindow {
+ hwnd: 7,
+ app_id: "chat".into(),
+ minimized: true,
+ },
+ TrackedWindow {
+ hwnd: 8,
+ app_id: "chat".into(),
+ minimized: false,
+ },
+ ];
+ let mut attention = Attention::default();
+ attention.request(7, 2);
+ let app = Entry {
+ kind: ItemKind::Icon,
+ id: Some("chat".into()),
+ role: Role::App,
+ running: true,
+ members: Vec::new(),
+ };
+ let group = Entry {
+ id: Some("group:chat".into()),
+ role: Role::Group,
+ members: vec!["chat".into()],
+ ..app.clone()
+ };
+ let thumbnail = Entry {
+ id: Some(window_id(7)),
+ role: Role::Window,
+ ..app.clone()
+ };
+ assert!(entry_has_attention(&attention, &windows, &app));
+ assert!(entry_has_attention(&attention, &windows, &group));
+ assert!(entry_has_attention(&attention, &windows, &thumbnail));
+ assert_eq!(active_attention_window(&windows, 7), 0);
+ attention.acknowledge(active_attention_window(&windows, 8));
+ assert!(entry_has_attention(&attention, &windows, &app));
+ attention.acknowledge(7);
+ assert!(!entry_has_attention(&attention, &windows, &group));
+ }
+
+ #[test]
+ #[ignore = "Requires Explorer's shell hooks; uses only off-screen test-owned windows"]
+ fn native_flash_request_produces_the_shell_event_used_by_dock_badges() -> Result<()> {
+ use std::time::Duration;
+ use windows::Win32::UI::WindowsAndMessaging::{
+ DeregisterShellHookWindow, DestroyWindow, FLASHW_STOP, FLASHW_TRAY, FLASHWINFO,
+ FlashWindowEx, SW_SHOWNOACTIVATE, ShowWindow, WS_EX_APPWINDOW, WS_OVERLAPPEDWINDOW,
+ };
+ struct Window(HWND);
+ impl Drop for Window {
+ fn drop(&mut self) {
+ unsafe {
+ let _ = DeregisterShellHookWindow(self.0);
+ let _ = DestroyWindow(self.0);
+ }
+ }
+ }
+ let receiver = Window(unsafe {
+ CreateWindowExW(
+ WS_EX_TOOLWINDOW,
+ w!("STATIC"),
+ w!("Muelle badge receiver test"),
+ WS_POPUP,
+ -32000,
+ -32000,
+ 80,
+ 40,
+ None,
+ None,
+ None,
+ None,
+ )?
+ });
+ let source = Window(unsafe {
+ CreateWindowExW(
+ WS_EX_APPWINDOW | WS_EX_NOACTIVATE,
+ w!("STATIC"),
+ w!("Muelle native attention test"),
+ WS_OVERLAPPEDWINDOW,
+ -32000,
+ -32000,
+ 160,
+ 120,
+ None,
+ None,
+ None,
+ None,
+ )?
+ });
+ let message = unsafe {
+ RegisterShellHookWindow(receiver.0).ok()?;
+ let _ = ShowWindow(source.0, SW_SHOWNOACTIVATE);
+ RegisterWindowMessageW(w!("SHELLHOOK"))
+ };
+ let pump = |duration: Duration| {
+ let until = Instant::now() + duration;
+ let mut found = false;
+ while Instant::now() < until {
+ let mut event = MSG::default();
+ while unsafe { PeekMessageW(&mut event, None, 0, 0, PM_REMOVE) }.as_bool() {
+ found |= event.hwnd == receiver.0
+ && event.message == message
+ && event.wParam.0 == HSHELL_FLASH
+ && event.lParam.0 == source.0.0 as isize;
+ unsafe {
+ DispatchMessageW(&event);
+ }
+ }
+ if found {
+ break;
+ }
+ std::thread::sleep(Duration::from_millis(5));
+ }
+ found
+ };
+ pump(Duration::from_millis(350));
+ let mut info = FLASHWINFO {
+ cbSize: size_of::<FLASHWINFO>() as u32,
+ hwnd: source.0,
+ dwFlags: FLASHW_TRAY,
+ uCount: 2,
+ dwTimeout: 100,
+ };
+ unsafe {
+ let _ = FlashWindowEx(&info);
+ }
+ let found = pump(Duration::from_secs(2));
+ info.dwFlags = FLASHW_STOP;
+ unsafe {
+ let _ = FlashWindowEx(&info);
+ }
+ assert!(found, "Explorer did not publish the native attention event");
+ Ok(())
+ }
+}
+
#[cfg(test)]
mod performance_tests {
use super::BinQueryGate;
diff --git a/apps/dock/src/gfx.rs b/apps/dock/src/gfx.rs
index cdef269..9da4c5b 100644
--- a/apps/dock/src/gfx.rs
+++ b/apps/dock/src/gfx.rs
@@ -1026,8 +1026,6 @@ impl Gfx {
};
// SAFETY: The brush, format and text live for each drawing call.
unsafe {
- const WIFI: [char; 4] = ['\u{E872}', '\u{E873}', '\u{E874}', '\u{E701}'];
- const WIFI_FULL: char = '\u{E701}';
let ink_brush = dc.CreateSolidColorBrush(&ink.color(), None)?;
let wifi_glyph = network_glyph::WIFI[usize::from(bars.clamp(1, 4)) - 1];
for &(glyph, opacity) in &[(network_glyph::WIFI_FULL, 0.3f32), (wifi_glyph, 1.0f32)]
diff --git a/apps/dock/src/group_view.rs b/apps/dock/src/group_view.rs
index adcc025..b0a7f63 100644
--- a/apps/dock/src/group_view.rs
+++ b/apps/dock/src/group_view.rs
@@ -42,7 +42,7 @@ use windows_numerics::{Vector2, Vector3};
use crate::{
app,
gfx::{Gfx, Ink},
- scene::Theme,
+ scene::{AttentionBadge, Theme},
};
const TIMER: usize = 1;
@@ -263,6 +263,7 @@ const fn rgba(r: u8, g: u8, b: u8, a: u8) -> Color {
struct ItemVisual {
root: ContainerVisual,
highlight: SpriteVisual,
+ attention: Option<AttentionBadge>,
}
pub struct GroupView {
@@ -279,6 +280,7 @@ pub struct GroupView {
panel: Option<ContainerVisual>,
anchor: RECT,
scale: f32,
+ theme: Theme,
opened: Instant,
animated: bool,
/// The app pressed, and where the pointer was on screen.
@@ -340,6 +342,7 @@ impl GroupView {
panel: None,
anchor: place.anchor,
scale: place.scale,
+ theme: place.theme,
opened: Instant::now(),
animated: animations_enabled(),
pressed: None,
@@ -388,6 +391,37 @@ impl GroupView {
&self.ids
}
+ pub fn set_attention(&mut self, gfx: &Gfx, pending: impl Fn(&str) -> bool) -> Result<()> {
+ for ((id, item), rect) in self
+ .ids
+ .iter()
+ .zip(&mut self.visuals)
+ .zip(&self.layout.icons)
+ {
+ let on = pending(id);
+ if on && item.attention.is_none() {
+ let badge = AttentionBadge::new(gfx, self.theme)?;
+ item.root.Children()?.InsertAtTop(&badge.visual)?;
+ item.attention = Some(badge);
+ }
+ if let Some(badge) = &mut item.attention {
+ badge.set_visible(on)?;
+ badge.place(
+ muelle_core::layout::Rect {
+ x: 0.0,
+ y: 0.0,
+ width: (rect.right - rect.left) as f32,
+ height: (rect.bottom - rect.top) as f32,
+ },
+ self.scale,
+ 1.0,
+ true,
+ )?;
+ }
+ }
+ Ok(())
+ }
+
fn build(&mut self, gfx: &Gfx, items: &[GroupItem], theme: Theme) -> Result<()> {
let c = &gfx.compositor;
let s = self.scale;
@@ -490,6 +524,7 @@ impl GroupView {
self.visuals.push(ItemVisual {
root: app,
highlight,
+ attention: None,
});
self.targets.push(target);
}
diff --git a/apps/dock/src/menubar.rs b/apps/dock/src/menubar.rs
index 8f44eca..ff1d7a0 100644
--- a/apps/dock/src/menubar.rs
+++ b/apps/dock/src/menubar.rs
@@ -241,7 +241,12 @@ impl Look {
fn panel_height(&self) -> f32 {
match self.panel {
Some(Island::Music) => 136.0,
- Some(Island::Usage) => 74.0 + self.active_providers.count() as f32 * ISLAND_ROW_HEIGHT,
+ Some(Island::Usage) => {
+ 74.0 + island_providers(self)
+ .iter()
+ .map(|(_, usage, _)| usage_row_height(usage))
+ .sum::<f32>()
+ }
None => 0.0,
}
}
@@ -271,6 +276,7 @@ enum IslandAction {
Media(MediaControl),
Refresh,
OpenCodeConnectionHelp,
+ OpenCodeConsole,
}
struct IslandHit {
@@ -655,7 +661,7 @@ fn draw_usage_row(
add_panel_text(
gfx,
layers,
- provider.name(),
+ usage.name(provider),
left + px(53.0),
y + px(10.0),
scale,
@@ -668,7 +674,11 @@ fn draw_usage_row(
add_panel_text(
gfx,
layers,
- &main.title(),
+ &if provider == Provider::OpenCode {
+ format!("Go · {}", main.title())
+ } else {
+ main.title()
+ },
left + px(53.0),
y + px(30.0),
scale,
@@ -763,7 +773,7 @@ fn draw_usage_row(
0.7,
)?;
}
- if let Some(secondary) = usage.windows.get(1) {
+ for (index, secondary) in usage.windows.iter().skip(1).enumerate() {
add_visual(
c,
layers,
@@ -774,7 +784,7 @@ fn draw_usage_row(
})?
.cast()?,
left + px(14.0),
- y + px(83.0),
+ y + px(83.0 + index as f32 * 26.0),
width - px(28.0),
px(1.0),
)?;
@@ -783,7 +793,7 @@ fn draw_usage_row(
layers,
&format!("{} · {}%", secondary.title(), secondary.used_percent),
left + px(14.0),
- y + px(87.0),
+ y + px(87.0 + index as f32 * 26.0),
scale,
11.5,
true,
@@ -796,7 +806,7 @@ fn draw_usage_row(
layers,
&format!("{} {reset}", text.usage_resets),
right - px(14.0),
- y + px(87.0),
+ y + px(87.0 + index as f32 * 26.0),
scale,
11.5,
false,
@@ -805,7 +815,10 @@ fn draw_usage_row(
)?;
}
}
- } else {
+ } else if !usage
+ .opencode
+ .is_some_and(|details| !details.go && details.zen)
+ {
let message = match usage.state {
State::Loading => text.usage_loading,
State::SignIn if provider == Provider::OpenCode => text.usage_opencode_connect,
@@ -825,34 +838,81 @@ fn draw_usage_row(
0.72,
)?;
}
+ if let Some(details) = usage.opencode.filter(|details| details.zen) {
+ let offset = zen_row_offset(usage);
+ add_panel_text(
+ gfx,
+ layers,
+ text.usage_zen_local,
+ left + px(14.0),
+ y + px(offset),
+ scale,
+ 11.0,
+ false,
+ ink,
+ 0.78,
+ )?;
+ if let Some(spend) = details.spend {
+ add_panel_text_right(
+ gfx,
+ layers,
+ &spend.amount(),
+ right - px(14.0),
+ y + px(offset + 19.0),
+ scale,
+ 16.0,
+ true,
+ ink,
+ 1.0,
+ )?;
+ } else {
+ add_panel_text_right(
+ gfx,
+ layers,
+ text.usage_no_local,
+ right - px(14.0),
+ y + px(offset + 21.0),
+ scale,
+ 11.0,
+ false,
+ ink,
+ 0.7,
+ )?;
+ }
+ add_panel_text(
+ gfx,
+ layers,
+ text.usage_device_scope,
+ left + px(14.0),
+ y + px(offset + 43.0),
+ scale,
+ 10.5,
+ false,
+ ink,
+ 0.65,
+ )?;
+ }
Ok(())
}
-#[expect(
- clippy::too_many_arguments,
- reason = "Text placement needs its coordinates and typography at the call site"
-)]
-fn add_text(
- gfx: &Gfx,
- layers: &VisualCollection,
- value: &str,
- x: f32,
- y: f32,
- scale: f32,
- bold: bool,
- ink: Ink,
-) -> Result<LabelBrush> {
- let label = gfx.text_brush(value, scale, bold, ink)?;
- add_visual(
- &gfx.compositor,
- layers,
- &label.brush.cast()?,
- x,
- y,
- label.width,
- label.height,
- )?;
- Ok(label)
+fn quota_row_height(usage: &ProviderUsage) -> f32 {
+ ISLAND_ROW_HEIGHT + usage.windows.len().saturating_sub(2) as f32 * 26.0
+}
+
+fn zen_row_offset(usage: &ProviderUsage) -> f32 {
+ if usage.opencode.is_some_and(|details| details.go) {
+ quota_row_height(usage) - 5.0
+ } else {
+ 50.0
+ }
+}
+
+fn usage_row_height(usage: &ProviderUsage) -> f32 {
+ if usage.opencode.is_some_and(|details| details.zen) {
+ zen_row_offset(usage) + 102.0
+ } else {
+ quota_row_height(usage)
+ }
}
impl MenuBar {
@@ -1441,7 +1501,13 @@ impl MenuBar {
// Shell extensions and browser activation run in the
// existing disposable worker, never on the bar's UI thread.
crate::shell_work::dispatch(crate::shell_work::Action::Open {
- id: "https://opencode.ai/docs/console/go/".to_owned(),
+ id: "https://opencode.ai/docs/providers/".to_owned(),
+ })
+ .inspect_err(|_| crate::shell_work::notify_not_started())?;
+ }
+ IslandAction::OpenCodeConsole => {
+ crate::shell_work::dispatch(crate::shell_work::Action::Open {
+ id: "https://opencode.ai/console".to_owned(),
})
.inspect_err(|_| crate::shell_work::notify_not_started())?;
}
@@ -2081,8 +2147,10 @@ impl MenuBar {
button_height,
IslandAction::Refresh,
));
- for (index, (provider, usage, accent)) in providers.iter().enumerate() {
- let y = px(48.0 + index as f32 * ISLAND_ROW_HEIGHT);
+ let mut row_top = 48.0;
+ for (provider, usage, accent) in providers {
+ let y = px(row_top);
+ row_top += usage_row_height(usage);
let inset = px(23.0);
add_visual(
c,
@@ -2104,10 +2172,22 @@ impl MenuBar {
island_width,
y,
)?;
- if *provider == Provider::OpenCode && usage.state == State::SignIn {
- let label =
- gfx.text_brush_sized(title.usage_connection_help, scale, 11.0, true, ink)?;
- let (left, top) = (px(76.0), y + px(65.0));
+ let connection = (*provider == Provider::OpenCode && usage.state == State::SignIn)
+ .then_some((
+ title.usage_connection_help,
+ 65.0,
+ IslandAction::OpenCodeConnectionHelp,
+ ));
+ let console = usage.opencode.filter(|details| details.zen).map(|_| {
+ (
+ title.usage_open_console,
+ zen_row_offset(usage) + 67.0,
+ IslandAction::OpenCodeConsole,
+ )
+ });
+ for (text, offset, action) in connection.into_iter().chain(console) {
+ let label = gfx.text_brush_sized(text, scale, 11.0, true, ink)?;
+ let (left, top) = (px(37.0), y + px(offset));
let (width, height) = (label.width + px(20.0), px(25.0));
add_rounded_box(
c,
@@ -2129,13 +2209,8 @@ impl MenuBar {
label.width,
label.height,
)?;
- self.island_hits.push(geometry.hit(
- left,
- top,
- width,
- height,
- IslandAction::OpenCodeConnectionHelp,
- ));
+ self.island_hits
+ .push(geometry.hit(left, top, width, height, action));
}
}
let newest_age = providers
@@ -2805,22 +2880,34 @@ fn draw_compact_usage(
icon_size as f32,
)?;
}
- let percent = usage.main_window().map_or("—".to_owned(), |window| {
- format!("{}%", window.used_percent)
- });
+ let percent = usage.compact_text();
if half > px(106.0) {
- add_text(
- gfx,
- content,
- &percent,
- start + px(25.0),
- px(6.0),
- scale,
- true,
- ink,
- )?;
+ let font = if usage.main_window().is_some() {
+ 14.0
+ } else {
+ 12.0
+ };
+ let label = gfx.text_brush_sized(&percent, scale, font, true, ink)?;
+ let reserve = if usage.main_window().is_some() {
+ 74.0
+ } else {
+ 50.0
+ };
+ if label.width <= half - px(reserve) {
+ add_visual(
+ c,
+ content,
+ &label.brush.cast()?,
+ start + px(25.0),
+ (bar_height - label.height) / 2.0,
+ label.width,
+ label.height,
+ )?;
+ }
}
- if half >= px(84.0) {
+ if half >= px(84.0)
+ && (usage.main_window().is_some() || usage.opencode.is_none_or(|details| !details.zen))
+ {
let ring = gfx.usage_ring(
usage.main_window().map(|window| window.used_percent),
scale,
@@ -2876,11 +2963,10 @@ fn draw_bubble_usage(
for (index, (provider, usage, _accent)) in providers.iter().enumerate() {
let slot_left = inset + index as f32 * slot;
anchors.push((*provider, slot_left + slot / 2.0));
- let percent = usage.main_window().map_or("—".to_owned(), |window| {
- format!("{}%", window.used_percent)
- });
+ let percent = usage.compact_text();
let label = if slot >= px(44.0) {
- Some(gfx.text_brush_sized(&percent, scale, 11.5, true, ink)?)
+ let label = gfx.text_brush_sized(&percent, scale, 11.5, true, ink)?;
+ (label.width + icon_size as f32 + gap <= slot).then_some(label)
} else {
None
};
@@ -3124,6 +3210,7 @@ mod island_tests {
state: State::SignIn,
windows: Vec::new(),
fetched_at: None,
+ opencode: None,
};
// Yesterday's saved reading is not evidence that Codex is running now.
look.usage.providers[Provider::Codex as usize] = ProviderUsage {
@@ -3135,6 +3222,7 @@ mod island_tests {
resets_at: None,
}],
fetched_at: Some(std::time::SystemTime::now() - Duration::from_secs(24 * 60 * 60)),
+ opencode: None,
};
assert!(
island_providers(&look)
@@ -3167,6 +3255,69 @@ mod island_tests {
.iter()
.any(|hit| matches!(hit.action, IslandAction::OpenCodeConnectionHelp))
);
+ // Real compositor coverage for Zen-only and combined cards, including
+ // a large currency label and all three Go windows.
+ for (go, spend) in [
+ (false, None),
+ (
+ false,
+ Some(usage::LocalSpend {
+ micro_usd: 9_999_990_000,
+ requests: 40,
+ }),
+ ),
+ (
+ true,
+ Some(usage::LocalSpend {
+ micro_usd: 1_250_000,
+ requests: 3,
+ }),
+ ),
+ ] {
+ let reading = &mut look.usage.providers[Provider::OpenCode as usize];
+ reading.opencode = Some(usage::OpenCodeDetails {
+ go,
+ zen: true,
+ spend,
+ });
+ reading.windows = if go {
+ [300, 10_080, 43_200]
+ .into_iter()
+ .map(|minutes| usage::Window {
+ label: None,
+ minutes,
+ used_percent: 15,
+ resets_at: Some(chrono::Utc::now() + chrono::Duration::hours(2)),
+ })
+ .collect()
+ } else {
+ Vec::new()
+ };
+ for style in [IslandStyle::Notch, IslandStyle::Bubble] {
+ look.widgets.island_style = style;
+ for scale in [1.0, 1.25, 1.5, 2.0] {
+ look.scale = scale;
+ for (light, glass) in [(true, true), (false, true), (false, false)] {
+ look.light = light;
+ look.glass = glass;
+ bar.build(&gfx, &look)?;
+ let hit = bar
+ .island_hits
+ .iter()
+ .find(|hit| matches!(hit.action, IslandAction::OpenCodeConsole))
+ .context("Zen console has no click target")?;
+ let (left, top, right, bottom) = hit.bounds;
+ assert!(left >= bar.panel_span.left && right <= bar.panel_span.right);
+ let first = bar
+ .island_hits
+ .iter()
+ .find(|hit| hit.at((left + right) / 2.0, (top + bottom) / 2.0))
+ .context("Zen console cannot be clicked")?;
+ assert!(matches!(first.action, IslandAction::OpenCodeConsole));
+ }
+ }
+ }
+ }
Ok(())
}
@@ -3654,6 +3805,7 @@ mod mascot_tests {
resets_at: None,
}],
fetched_at: None,
+ opencode: None,
};
}
snapshot
diff --git a/apps/dock/src/scene.rs b/apps/dock/src/scene.rs
index 775a338..b84baa7 100644
--- a/apps/dock/src/scene.rs
+++ b/apps/dock/src/scene.rs
@@ -221,6 +221,185 @@ pub struct SceneInput<'a> {
pub const BADGE_SIZE: f32 = 0.42;
pub const BADGE_INSIDE: f32 = 0.85;
+/// A native attention request, deliberately without a fabricated unread count.
+/// Its vector is allocated on first use and only transformed during animation.
+pub(crate) struct AttentionBadge {
+ pub(crate) visual: ShapeVisual,
+ visible: bool,
+}
+
+impl AttentionBadge {
+ pub(crate) fn new(gfx: &Gfx, theme: Theme) -> Result<Self> {
+ let c = &gfx.compositor;
+ let circle = c.CreateEllipseGeometry()?;
+ circle.SetCenter(v2(0.5, 0.5))?;
+ circle.SetRadius(v2(0.43, 0.43))?;
+ let shape = c.CreateSpriteShapeWithGeometry(&circle)?;
+ shape.SetFillBrush(&c.CreateColorBrushWithColor(if theme.light {
+ rgba(255, 59, 48, 255)
+ } else {
+ rgba(255, 69, 58, 255)
+ })?)?;
+ shape.SetStrokeBrush(&c.CreateColorBrushWithColor(if theme.light {
+ rgba(255, 255, 255, 245)
+ } else {
+ rgba(38, 38, 40, 245)
+ })?)?;
+ shape.SetStrokeThickness(0.12)?;
+ let visual = c.CreateShapeVisual()?;
+ visual.SetSize(v2(1.0, 1.0))?;
+ visual.Shapes()?.Append(&shape)?;
+ visual.SetIsVisible(false)?;
+ Ok(Self {
+ visual,
+ visible: false,
+ })
+ }
+
+ pub(crate) fn set_visible(&mut self, visible: bool) -> Result<()> {
+ if self.visible != visible {
+ self.visual.SetIsVisible(visible)?;
+ self.visible = visible;
+ }
+ Ok(())
+ }
+
+ pub(crate) fn place(&self, icon: Rect, scale: f32, opacity: f32, snap: bool) -> Result<()> {
+ if !self.visible {
+ return Ok(());
+ }
+ let rect = attention_rect(icon, scale);
+ let fit = |value: f32| if snap { value.round() } else { value };
+ self.visual
+ .SetScale(Vector3::new(fit(rect.width), fit(rect.height), 1.0))?;
+ self.visual.SetOffset(v3(fit(rect.x), fit(rect.y)))?;
+ self.visual.SetOpacity(opacity)?;
+ Ok(())
+ }
+}
+
+fn attention_rect(icon: Rect, scale: f32) -> Rect {
+ let side = (icon.width * 0.25)
+ .clamp(8.0 * scale, 14.0 * scale)
+ .min(icon.width.min(icon.height) * 0.45);
+ let inset = scale.min((icon.width - side) / 2.0).max(0.0);
+ Rect {
+ x: icon.x + icon.width - side - inset,
+ y: icon.y + inset,
+ width: side,
+ height: side,
+ }
+}
+
+#[cfg(test)]
+mod attention_tests {
+ use super::*;
+ use muelle_core::{
+ layout::{Metrics, layout},
+ magnify::{Magnifier, magnify},
+ };
+
+ #[test]
+ fn attention_stays_inside_small_magnified_and_high_dpi_icons() {
+ for scale in [1.0, 1.25, 1.5, 2.0, 3.0] {
+ for width in [16.0, 32.0, 48.0, 96.0] {
+ let icon = Rect {
+ x: 17.0,
+ y: -32.0,
+ width: width * scale,
+ height: width * scale,
+ };
+ let badge = attention_rect(icon, scale);
+ assert!(badge.x >= icon.x && badge.y >= icon.y);
+ assert!(badge.x + badge.width <= icon.x + icon.width);
+ assert!(badge.y + badge.height <= icon.y + icon.height);
+ assert!(badge.width > 0.0);
+ }
+ }
+ }
+
+ #[test]
+ #[ignore = "Requires Windows desktop composition; creates no visible window"]
+ fn native_attention_badges_reuse_visuals_follow_drag_and_hide_without_rebuilding() -> Result<()>
+ {
+ use windows::Win32::System::WinRT::{
+ CreateDispatcherQueueController, DQTAT_COM_STA, DQTYPE_THREAD_CURRENT,
+ DispatcherQueueOptions,
+ };
+ let _queue = unsafe {
+ CreateDispatcherQueueController(DispatcherQueueOptions {
+ dwSize: size_of::<DispatcherQueueOptions>() as u32,
+ threadType: DQTYPE_THREAD_CURRENT,
+ apartmentType: DQTAT_COM_STA,
+ })?
+ };
+ let gfx = Gfx::new()?;
+ for scale in [1.0, 1.25, 1.5, 2.0] {
+ for light in [false, true] {
+ let layout = layout(
+ &[ItemKind::Icon, ItemKind::Icon],
+ &Metrics::DEFAULT.scaled(scale),
+ );
+ let contents = [SlotContent::default(); 2];
+ let mut scene = Scene::build(
+ &gfx,
+ &SceneInput {
+ layout: &layout,
+ contents: &contents,
+ theme: Theme::for_system(light, true),
+ scale,
+ origin: (0.0, 0.0),
+ remove_label: None,
+ },
+ )?;
+ let root = scene.root.clone();
+ scene.set_attention(&gfx, [true, false].into_iter())?;
+ let visual = scene.attention[0]
+ .as_ref()
+ .ok_or_else(|| anyhow::anyhow!("missing badge"))?
+ .visual
+ .clone();
+ scene.set_attention(&gfx, [true, false].into_iter())?;
+ assert!(
+ scene.attention[0]
+ .as_ref()
+ .is_some_and(|badge| badge.visual == visual)
+ );
+ assert!(scene.attention[1].is_none());
+ let state = magnify(
+ &layout,
+ 24.0 * scale,
+ 1.0,
+ &Magnifier {
+ range: 144.0 * scale,
+ max_scale: 1.6,
+ },
+ );
+ scene.apply(&Frame {
+ state: &state,
+ hovered: None,
+ lifts: &[8.0 * scale, 0.0],
+ drag: Some(Drag {
+ index: 0,
+ center: (80.0 * scale, 20.0 * scale),
+ removing: false,
+ ghost: false,
+ }),
+ target: None,
+ slide: 0.0,
+ snap: false,
+ })?;
+ assert!(visual.IsVisible()?);
+ assert!(visual.Scale()?.X > 0.0);
+ scene.set_attention(&gfx, [false, false].into_iter())?;
+ assert!(!visual.IsVisible()?);
+ assert!(scene.root == root);
+ }
+ }
+ Ok(())
+ }
+}
+
/// An icon following the cursor while it is dragged.
#[derive(Clone, Copy)]
pub struct Drag {
@@ -290,6 +469,9 @@ pub struct Scene {
raised: Cell<Option<usize>>,
slots: Vec<SpriteVisual>,
badges: Vec<Option<SpriteVisual>>,
+ attention: Vec<Option<AttentionBadge>>,
+ attention_theme: Theme,
+ scale: f32,
indicators: Vec<Option<ShapeVisual>>,
labels: Vec<Option<Label>>,
remove_label: Option<Label>,
@@ -426,12 +608,31 @@ impl Scene {
raised: Cell::new(None),
slots,
badges,
+ attention: (0..layout.slots.len()).map(|_| None).collect(),
+ attention_theme: theme,
+ scale,
indicators,
labels,
remove_label,
})
}
+ /// Changes only badge visuals: notifications never rebuild the layout or
+ /// close an open window picker. Repeated events reuse the same visual.
+ pub fn set_attention(&mut self, gfx: &Gfx, pending: impl Iterator<Item = bool>) -> Result<()> {
+ for (notice, on) in self.attention.iter_mut().zip(pending) {
+ if on && notice.is_none() {
+ let badge = AttentionBadge::new(gfx, self.attention_theme)?;
+ self.content.Children()?.InsertAtTop(&badge.visual)?;
+ *notice = Some(badge);
+ }
+ if let Some(badge) = notice {
+ badge.set_visible(on)?;
+ }
+ }
+ Ok(())
+ }
+
/// - `lifts`: how far each slot rises above its resting position (bounce).
/// - `snap`: whether to align to pixels. Used at rest for sharpness; fractional
/// positions are retained during movement for smooth animation.
@@ -496,6 +697,25 @@ impl Scene {
fit(y + height - side * BADGE_INSIDE),
))?;
}
+ if let Some(Some(notice)) = self.attention.get(index) {
+ notice.place(
+ Rect {
+ x,
+ y,
+ width,
+ height,
+ },
+ self.scale,
+ if dragged.is_some_and(|drag| drag.ghost) {
+ 0.35
+ } else if dragged.is_some_and(|drag| drag.removing) {
+ 0.55
+ } else {
+ 1.0
+ },
+ snap,
+ )?;
+ }
if let Some(Some(indicator)) = self.indicators.get(index) {
indicator.SetIsVisible(dragged.is_none())?;
indicator.SetOffset(v3(
@@ -535,6 +755,14 @@ impl Scene {
let children = self.content.Children()?;
children.Remove(visual)?;
children.InsertAtTop(visual)?;
+ if let Some(Some(badge)) = index.and_then(|index| self.badges.get(index)) {
+ children.Remove(badge)?;
+ children.InsertAtTop(badge)?;
+ }
+ if let Some(Some(badge)) = index.and_then(|index| self.attention.get(index)) {
+ children.Remove(&badge.visual)?;
+ children.InsertAtTop(&badge.visual)?;
+ }
}
self.raised.set(index);
Ok(())
diff --git a/apps/dock/src/strings.rs b/apps/dock/src/strings.rs
index 88326a3..10924bc 100644
--- a/apps/dock/src/strings.rs
+++ b/apps/dock/src/strings.rs
@@ -32,6 +32,10 @@ pub struct Strings {
pub usage_sign_in: &'static str,
pub usage_opencode_connect: &'static str,
pub usage_connection_help: &'static str,
+ pub usage_zen_local: &'static str,
+ pub usage_device_scope: &'static str,
+ pub usage_no_local: &'static str,
+ pub usage_open_console: &'static str,
pub usage_unavailable: &'static str,
pub usage_loading: &'static str,
pub usage_stale: &'static str,
@@ -74,8 +78,12 @@ const ES: Strings = Strings {
usage_refresh: "Actualizar",
usage_refreshing: "Actualizando…",
usage_sign_in: "Inicia sesión en el cliente",
- usage_opencode_connect: "En OpenCode: /connect → OpenCode Go",
+ usage_opencode_connect: "En OpenCode: /connect → Go o Zen",
usage_connection_help: "Cómo conectar",
+ usage_zen_local: "Zen · gasto local estimado (30 d)",
+ usage_device_scope: "Este equipo · todas las cuentas · no es el saldo",
+ usage_no_local: "Gasto local no disponible",
+ usage_open_console: "Ver saldo en OpenCode",
usage_unavailable: "No disponible",
usage_loading: "Cargando…",
usage_stale: "Sin actualizar",
@@ -115,8 +123,12 @@ const EN: Strings = Strings {
usage_refresh: "Refresh",
usage_refreshing: "Refreshing…",
usage_sign_in: "Sign in to the client",
- usage_opencode_connect: "In OpenCode: /connect → OpenCode Go",
+ usage_opencode_connect: "In OpenCode: /connect → Go or Zen",
usage_connection_help: "Connection guide",
+ usage_zen_local: "Zen · estimated local cost (30 d)",
+ usage_device_scope: "This device · all accounts · not your balance",
+ usage_no_local: "Local cost unavailable",
+ usage_open_console: "View balance in OpenCode",
usage_unavailable: "Unavailable",
usage_loading: "Loading…",
usage_stale: "Not updated",
@@ -156,8 +168,12 @@ const FR: Strings = Strings {
usage_refresh: "Actualiser",
usage_refreshing: "Actualisation…",
usage_sign_in: "Se connecter dans le client",
- usage_opencode_connect: "Dans OpenCode : /connect → OpenCode Go",
+ usage_opencode_connect: "Dans OpenCode : /connect → Go ou Zen",
usage_connection_help: "Comment connecter",
+ usage_zen_local: "Zen · coût local estimé (30 j)",
+ usage_device_scope: "Cet appareil · tous les comptes · pas votre solde",
+ usage_no_local: "Coût local indisponible",
+ usage_open_console: "Voir le solde dans OpenCode",
usage_unavailable: "Indisponible",
usage_loading: "Chargement…",
usage_stale: "Non actualisé",
diff --git a/apps/dock/src/usage.rs b/apps/dock/src/usage.rs
index e2c43b8..120a68d 100644
--- a/apps/dock/src/usage.rs
+++ b/apps/dock/src/usage.rs
@@ -30,6 +30,9 @@ use windows::Win32::{
const REFRESH_INTERVAL: Duration = Duration::from_secs(5 * 60);
+mod opencode;
+pub use opencode::{LocalSpend, OpenCodeDetails};
+
#[derive(Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum State {
Loading,
@@ -73,6 +76,8 @@ pub struct ProviderUsage {
pub state: State,
pub windows: Vec<Window>,
pub fetched_at: Option<SystemTime>,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub opencode: Option<OpenCodeDetails>,
}
impl Default for ProviderUsage {
@@ -81,11 +86,33 @@ impl Default for ProviderUsage {
state: State::Loading,
windows: Vec::new(),
fetched_at: None,
+ opencode: None,
}
}
}
impl ProviderUsage {
+ pub fn name(&self, provider: Provider) -> &'static str {
+ match (provider, self.opencode.as_ref()) {
+ (Provider::OpenCode, Some(details)) => match (details.go, details.zen) {
+ (true, false) => "OpenCode Go",
+ (false, true) => "OpenCode Zen",
+ _ => "OpenCode",
+ },
+ _ => provider.name(),
+ }
+ }
+
+ pub fn compact_text(&self) -> String {
+ if let Some(window) = self.main_window() {
+ format!("{}%", window.used_percent)
+ } else if let Some(spend) = self.opencode.as_ref().and_then(|details| details.spend) {
+ spend.amount()
+ } else {
+ "—".to_owned()
+ }
+ }
+
pub fn main_window(&self) -> Option<&Window> {
self.windows.first()
}
@@ -123,7 +150,7 @@ impl Provider {
match self {
Self::Claude => "Claude",
Self::Codex => "Codex",
- Self::OpenCode => "OpenCode Go",
+ Self::OpenCode => "OpenCode",
Self::Gemini => "Gemini",
}
}
@@ -348,8 +375,12 @@ impl Drop for Monitor {
}
fn merge(previous: &mut ProviderUsage, fetched: ProviderUsage) {
- if fetched.state == State::Unavailable && !previous.windows.is_empty() {
+ if fetched.state == State::Unavailable
+ && !previous.windows.is_empty()
+ && fetched.opencode.is_none_or(|details| details.go)
+ {
previous.state = State::Unavailable;
+ previous.opencode = fetched.opencode;
} else {
*previous = fetched;
}
@@ -401,6 +432,7 @@ fn ready(windows: Vec<Window>) -> ProviderUsage {
state: State::Ready,
windows,
fetched_at: Some(SystemTime::now()),
+ opencode: None,
}
}
@@ -502,10 +534,49 @@ fn fetch_opencode(client: &Client) -> ProviderUsage {
let api_key = env::var("OPENCODE_API_KEY").ok();
let data_home = env::var_os("XDG_DATA_HOME").map(PathBuf::from);
let home = home();
- let Some(token) = opencode_token(api_key.as_deref(), data_home.as_deref(), home.as_deref())
- else {
- return sign_in();
- };
+ let path = opencode_auth_path(data_home.as_deref(), home.as_deref());
+ // One bounded read, shared by both credential detection and the Go request.
+ let auth = path.as_deref().and_then(read_opencode_auth);
+ let token = opencode_key(api_key.as_deref(), auth.as_ref());
+ // OPENCODE_API_KEY can belong to either service. An environment key alone
+ // is not evidence of a Go subscription: require its saved ID or real quotas.
+ let go_key = auth
+ .as_ref()
+ .is_some_and(|auth| opencode_entry(auth, "opencode-go").is_some());
+ let zen_key = auth
+ .as_ref()
+ .is_some_and(|auth| opencode_entry(auth, "opencode").is_some());
+ let spend = path
+ .as_deref()
+ .and_then(Path::parent)
+ .and_then(|directory| {
+ opencode::local_spend(&directory.join("opencode.db"), Utc::now())
+ .ok()
+ .flatten()
+ });
+ let quota = token.map_or_else(sign_in, |token| fetch_opencode_go(client, token));
+ combine_opencode(quota, go_key, zen_key, spend)
+}
+
+fn combine_opencode(
+ mut quota: ProviderUsage,
+ go_key: bool,
+ zen_key: bool,
+ spend: Option<LocalSpend>,
+) -> ProviderUsage {
+ let go = go_key || !quota.windows.is_empty();
+ let zen = zen_key || spend.is_some();
+ // Zen's local cost history needs no authentication. Lack of a Go subscription
+ // must not produce a misleading sign-in prompt for a Zen-only connection.
+ if !go && zen {
+ quota.state = State::Ready;
+ quota.fetched_at = Some(SystemTime::now());
+ }
+ quota.opencode = Some(OpenCodeDetails { go, zen, spend });
+ quota
+}
+
+fn fetch_opencode_go(client: &Client, token: &str) -> ProviderUsage {
let Ok(response) = client
.get("https://opencode.ai/zen/go/v1/usage")
.bearer_auth(token)
@@ -514,7 +585,7 @@ fn fetch_opencode(client: &Client) -> ProviderUsage {
else {
return unavailable();
};
- if matches!(response.status().as_u16(), 401 | 403) {
+ if response.status().as_u16() == 401 {
return sign_in();
}
let Ok(body) = response
@@ -550,28 +621,39 @@ fn opencode_auth_path(data_home: Option<&Path>, home: Option<&Path>) -> Option<P
}
fn opencode_key<'a>(api_key: Option<&'a str>, auth: Option<&'a Value>) -> Option<&'a str> {
- let usable = |key: &'a str| {
- let key = key.trim();
- (!key.is_empty()
- && key != "opencode-oauth-dummy-key"
- && !key
- .bytes()
- .any(|byte| byte.is_ascii_whitespace() || byte.is_ascii_control()))
- .then_some(key)
- };
- api_key.and_then(usable).or_else(|| {
+ api_key.and_then(opencode_usable_key).or_else(|| {
// Go has its own provider ID. Keep the legacy Zen API-key entry as a
// fallback, but never forward another provider's OAuth or API secrets.
- ["opencode-go", "opencode"].into_iter().find_map(|id| {
- let entry = auth?.get(id)?;
- if entry.get("type")?.as_str()? != "api" {
- return None;
- }
- entry.get("key")?.as_str().and_then(usable)
- })
+ ["opencode-go", "opencode"]
+ .into_iter()
+ .find_map(|id| opencode_entry(auth?, id))
})
}
+fn opencode_usable_key(key: &str) -> Option<&str> {
+ let key = key.trim();
+ (!key.is_empty()
+ && key != "opencode-oauth-dummy-key"
+ && !key
+ .bytes()
+ .any(|byte| byte.is_ascii_whitespace() || byte.is_ascii_control()))
+ .then_some(key)
+}
+
+fn opencode_entry<'a>(auth: &'a Value, id: &str) -> Option<&'a str> {
+ let entry = auth.get(id)?;
+ (entry.get("type")?.as_str()? == "api")
+ .then(|| entry.get("key")?.as_str().and_then(opencode_usable_key))?
+}
+
+fn read_opencode_auth(path: &Path) -> Option<Value> {
+ let file = fs::File::open(path).ok()?;
+ let mut bytes = Vec::new();
+ file.take(256 * 1024).read_to_end(&mut bytes).ok()?;
+ serde_json::from_slice(&bytes).ok()
+}
+
+#[cfg(test)]
fn opencode_token(
api_key: Option<&str>,
data_home: Option<&Path>,
@@ -581,7 +663,7 @@ fn opencode_token(
return Some(key.to_owned());
}
let path = opencode_auth_path(data_home, home)?;
- let auth: Value = serde_json::from_slice(&fs::read(path).ok()?).ok()?;
+ let auth = read_opencode_auth(&path)?;
opencode_key(None, Some(&auth)).map(str::to_owned)
}
@@ -603,11 +685,19 @@ fn parse_opencode(value: &Value) -> Vec<Window> {
(limit > 0.0).then(|| (used * 100.0 / limit).clamp(0.0, 100.0).round() as u8)
})?;
let resets_at = lane
- .get("resetInSec")
- .or_else(|| lane.get("reset_in_sec"))
- .and_then(Value::as_i64)
- .filter(|seconds| *seconds >= 0)
- .and_then(|seconds| DateTime::from_timestamp(Utc::now().timestamp() + seconds, 0));
+ .get("resetsAt")
+ .or_else(|| lane.get("resets_at"))
+ .and_then(Value::as_str)
+ .and_then(|time| DateTime::parse_from_rfc3339(time).ok())
+ .map(|time| time.with_timezone(&Utc))
+ .or_else(|| {
+ lane.get("resetInSec")
+ .or_else(|| lane.get("reset_in_sec"))
+ .and_then(Value::as_i64)
+ .filter(|seconds| *seconds >= 0)
+ .and_then(|seconds| Utc::now().timestamp().checked_add(seconds))
+ .and_then(|seconds| DateTime::from_timestamp(seconds, 0))
+ });
Some(Window {
label: None,
minutes,
@@ -984,6 +1074,7 @@ fn scan_rollout(path: &std::path::Path) -> Option<ProviderUsage> {
state: State::Ready,
windows,
fetched_at,
+ opencode: None,
});
}
None
@@ -1062,6 +1153,75 @@ mod tests {
use super::*;
use serde_json::json;
+ #[test]
+ fn opencode_go_reads_official_absolute_resets_and_rejects_overflowing_legacy_dates() {
+ let windows = parse_opencode(&json!({"usage": {
+ "rolling": {"percent": 15, "resetsAt": "2026-11-20T22:00:00Z"},
+ "weekly": {"percent": 35, "resets_at": "2026-11-23T00:00:00Z"},
+ "monthly": {"percent": 50, "resetInSec": i64::MAX}
+ }}));
+ assert_eq!(windows.len(), 3);
+ assert_eq!(
+ windows[0]
+ .resets_at
+ .map(|time| time.to_rfc3339())
+ .as_deref(),
+ Some("2026-11-20T22:00:00+00:00")
+ );
+ assert!(windows[1].resets_at.is_some());
+ assert!(windows[2].resets_at.is_none());
+ }
+
+ #[test]
+ fn opencode_zen_without_go_never_requests_a_go_login_or_invents_a_quota() {
+ let usage = combine_opencode(unavailable(), false, true, None);
+ assert!(usage.state == State::Ready);
+ assert_eq!(usage.name(Provider::OpenCode), "OpenCode Zen");
+ assert!(usage.main_window().is_none());
+ assert_eq!(usage.compact_text(), "—");
+ let usage = combine_opencode(
+ sign_in(),
+ false,
+ false,
+ Some(LocalSpend {
+ micro_usd: 1_250_000,
+ requests: 3,
+ }),
+ );
+ assert_eq!(usage.name(Provider::OpenCode), "OpenCode Zen");
+ assert_eq!(usage.compact_text(), "$1.25");
+ }
+
+ #[test]
+ fn opencode_keeps_go_quotas_and_zen_cost_separate_in_the_same_snapshot() {
+ let quota = ready(parse_opencode(&json!({"usage": {
+ "rolling": {"percent": 15}, "weekly": {"percent": 35}, "monthly": {"percent": 50}
+ }})));
+ let usage = combine_opencode(
+ quota,
+ true,
+ true,
+ Some(LocalSpend {
+ micro_usd: 4_200_000,
+ requests: 5,
+ }),
+ );
+ assert_eq!(usage.name(Provider::OpenCode), "OpenCode");
+ assert_eq!(usage.compact_text(), "15%");
+ assert_eq!(usage.windows.len(), 3);
+ assert_eq!(
+ usage
+ .opencode
+ .and_then(|details| details.spend)
+ .map(LocalSpend::amount)
+ .as_deref(),
+ Some("$4.20")
+ );
+ let only_go = combine_opencode(sign_in(), true, false, None);
+ assert!(only_go.state == State::SignIn);
+ assert_eq!(only_go.name(Provider::OpenCode), "OpenCode Go");
+ }
+
#[test]
fn claude_missing_window_does_not_become_zero() {
let windows = parse_claude(
diff --git a/apps/dock/src/usage/opencode.rs b/apps/dock/src/usage/opencode.rs
new file mode 100644
index 0000000..2398f09
--- /dev/null
+++ b/apps/dock/src/usage/opencode.rs
@@ -0,0 +1,286 @@
+//! Device-local Zen cost history. This is not an account balance or invoice.
+//! Reads only the provider, cost and ID columns of recent assistant records.
+
+use std::{
+ collections::HashSet,
+ path::Path,
+ time::{Duration, Instant},
+};
+
+use chrono::{DateTime, Utc};
+use rusqlite::{Connection, OpenFlags, limits::Limit};
+use serde::{Deserialize, Serialize};
+
+const LOOKBACK_DAYS: i64 = 30;
+const MAX_ROWS: usize = 25_000;
+
+#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
+pub struct LocalSpend {
+ pub micro_usd: u64,
+ pub requests: u64,
+}
+
+impl LocalSpend {
+ pub fn amount(self) -> String {
+ let cents = self.micro_usd.saturating_add(5_000) / 10_000;
+ format!("${}.{:02}", cents / 100, cents % 100)
+ }
+}
+
+#[derive(Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
+pub struct OpenCodeDetails {
+ pub go: bool,
+ pub zen: bool,
+ pub spend: Option<LocalSpend>,
+}
+
+pub(super) fn local_spend(path: &Path, now: DateTime<Utc>) -> rusqlite::Result<Option<LocalSpend>> {
+ if !path.is_file() {
+ return Ok(None);
+ }
+ let mut db = Connection::open_with_flags(
+ path,
+ OpenFlags::SQLITE_OPEN_READ_ONLY | OpenFlags::SQLITE_OPEN_NO_MUTEX,
+ )?;
+ db.busy_timeout(Duration::from_millis(20))?;
+ // Connection-local settings: no schema, index, journal or checkpoint changes.
+ db.pragma_update(None, "query_only", true)?;
+ db.pragma_update(None, "trusted_schema", false)?;
+ db.pragma_update(None, "cache_size", -512)?;
+ db.set_limit(Limit::SQLITE_LIMIT_LENGTH, 1024 * 1024)?;
+ let started = Instant::now();
+ let mut steps = 0;
+ db.progress_handler(
+ 1_000,
+ Some(move || {
+ steps += 1;
+ steps > 2_500 || started.elapsed() > Duration::from_millis(250)
+ }),
+ )?;
+ read_spend(&db, now)
+}
+
+fn read_spend(db: &Connection, now: DateTime<Utc>) -> rusqlite::Result<Option<LocalSpend>> {
+ let since = (now - chrono::Duration::days(LOOKBACK_DAYS)).timestamp_millis();
+ let until = now.timestamp_millis();
+ let mut seen = HashSet::new();
+ let mut total = LocalSpend {
+ micro_usd: 0,
+ requests: 0,
+ };
+ // A migrated message can exist in both schemas. Prefer v2 and count its ID
+ // only once; never sum step-finish parts on top of their assistant's cost.
+ for (table, predicate) in [
+ (
+ "session_message",
+ "type = 'assistant' AND json_extract(data, '$.model.providerID') = 'opencode'",
+ ),
+ (
+ "message",
+ "json_extract(data, '$.role') = 'assistant' AND json_extract(data, '$.providerID') = 'opencode'",
+ ),
+ ] {
+ let exists: bool = db.query_row(
+ "SELECT EXISTS(SELECT 1 FROM sqlite_schema WHERE type = 'table' AND name = ?1)",
+ [table],
+ |row| row.get(0),
+ )?;
+ if !exists {
+ continue;
+ }
+ // Table and predicate are compile-time constants, not external input.
+ let sql = format!(
+ "SELECT id, json_extract(data, '$.cost') FROM {table}
+ WHERE time_created >= ?1 AND time_created <= ?2
+ AND CASE WHEN json_valid(data) THEN ({predicate}
+ AND json_type(data, '$.cost') IN ('integer', 'real')) ELSE 0 END
+ LIMIT {}",
+ MAX_ROWS + 1
+ );
+ let mut statement = db.prepare(&sql)?;
+ let mut rows = statement.query([since, until])?;
+ let mut read = 0;
+ while let Some(row) = rows.next()? {
+ read += 1;
+ if read > MAX_ROWS {
+ return Err(rusqlite::Error::InvalidQuery);
+ }
+ let id: String = row.get(0)?;
+ if id.len() > 256 {
+ return Err(rusqlite::Error::InvalidQuery);
+ }
+ if !seen.insert(id) {
+ continue;
+ }
+ if seen.len() > MAX_ROWS {
+ return Err(rusqlite::Error::InvalidQuery);
+ }
+ let dollars: f64 = row.get(1)?;
+ // Reject corrupt totals instead of presenting a partial/overflowed
+ // number as a reliable financial measurement.
+ if !dollars.is_finite() || !(0.0..=1_000_000.0).contains(&dollars) {
+ return Err(rusqlite::Error::InvalidQuery);
+ }
+ total.micro_usd = total
+ .micro_usd
+ .checked_add((dollars * 1_000_000.0).round() as u64)
+ .ok_or(rusqlite::Error::InvalidQuery)?;
+ total.requests += 1;
+ }
+ }
+ Ok((total.requests > 0).then_some(total))
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use anyhow::Result;
+
+ fn fixture(db: &Connection) -> Result<()> {
+ db.execute_batch("CREATE TABLE message(id TEXT PRIMARY KEY, time_created INTEGER, data TEXT);
+ CREATE TABLE session_message(id TEXT PRIMARY KEY, type TEXT, time_created INTEGER, data TEXT);")?;
+ Ok(())
+ }
+
+ #[test]
+ fn zen_cost_excludes_go_other_providers_user_messages_and_outside_the_period() -> Result<()> {
+ let db = Connection::open_in_memory()?;
+ fixture(&db)?;
+ let now = Utc::now();
+ for (id, role, provider, cost, time) in [
+ ("zen", "assistant", "opencode", 1.25, now),
+ ("free", "assistant", "opencode", 0.0, now),
+ ("go", "assistant", "opencode-go", 12.0, now),
+ ("codex", "assistant", "openai", 14.0, now),
+ ("user", "user", "opencode", 15.0, now),
+ (
+ "old",
+ "assistant",
+ "opencode",
+ 20.0,
+ now - chrono::Duration::days(31),
+ ),
+ (
+ "future",
+ "assistant",
+ "opencode",
+ 30.0,
+ now + chrono::Duration::days(1),
+ ),
+ ] {
+ let data = serde_json::json!({"role": role, "providerID": provider, "cost": cost});
+ db.execute(
+ "INSERT INTO message VALUES (?1, ?2, ?3)",
+ rusqlite::params![id, time.timestamp_millis(), data.to_string()],
+ )?;
+ }
+ assert_eq!(
+ read_spend(&db, now)?,
+ Some(LocalSpend {
+ micro_usd: 1_250_000,
+ requests: 2
+ })
+ );
+ Ok(())
+ }
+
+ #[test]
+ fn migrated_messages_are_counted_once_and_invalid_json_is_ignored() -> Result<()> {
+ let db = Connection::open_in_memory()?;
+ fixture(&db)?;
+ let now = Utc::now();
+ let legacy = r#"{"role":"assistant","providerID":"opencode","cost":5}"#;
+ let current = r#"{"model":{"providerID":"opencode"},"cost":2.5}"#;
+ db.execute(
+ "INSERT INTO message VALUES ('same', ?1, ?2)",
+ rusqlite::params![now.timestamp_millis(), legacy],
+ )?;
+ db.execute(
+ "INSERT INTO session_message VALUES ('same','assistant',?1,?2)",
+ rusqlite::params![now.timestamp_millis(), current],
+ )?;
+ db.execute(
+ "INSERT INTO message VALUES ('broken',?1,'invalid json')",
+ [now.timestamp_millis()],
+ )?;
+ assert_eq!(
+ read_spend(&db, now)?,
+ Some(LocalSpend {
+ micro_usd: 2_500_000,
+ requests: 1
+ })
+ );
+ Ok(())
+ }
+
+ #[test]
+ fn missing_history_is_unknown_and_corrupt_costs_do_not_become_zero() -> Result<()> {
+ let db = Connection::open_in_memory()?;
+ fixture(&db)?;
+ let now = Utc::now();
+ assert_eq!(read_spend(&db, now)?, None);
+ db.execute(
+ "INSERT INTO message VALUES ('bad',?1,?2)",
+ rusqlite::params![
+ now.timestamp_millis(),
+ r#"{"role":"assistant","providerID":"opencode","cost":-4}"#
+ ],
+ )?;
+ assert!(read_spend(&db, now).is_err());
+ Ok(())
+ }
+
+ #[test]
+ fn excessive_history_returns_unknown_instead_of_a_truncated_total() -> Result<()> {
+ let db = Connection::open_in_memory()?;
+ fixture(&db)?;
+ let now = Utc::now();
+ db.execute(
+ "WITH RECURSIVE n(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM n WHERE x < ?1)
+ INSERT INTO message SELECT 'msg_' || x, ?2,
+ '{\"role\":\"assistant\",\"providerID\":\"opencode\",\"cost\":0.01}' FROM n",
+ rusqlite::params![i64::try_from(MAX_ROWS + 1)?, now.timestamp_millis()],
+ )?;
+ assert!(read_spend(&db, now).is_err());
+ Ok(())
+ }
+
+ #[test]
+ fn wal_reads_do_not_modify_the_database_or_block_its_writer() -> Result<()> {
+ let root = std::env::temp_dir().join(format!(
+ "muelle-zen-{}-{}",
+ std::process::id(),
+ std::time::SystemTime::now()
+ .duration_since(std::time::UNIX_EPOCH)?
+ .as_nanos()
+ ));
+ std::fs::create_dir(&root)?;
+ let result = (|| -> Result<()> {
+ let path = root.join("opencode.db");
+ let db = Connection::open(&path)?;
+ db.pragma_update(None, "journal_mode", "WAL")?;
+ fixture(&db)?;
+ let now = Utc::now();
+ db.execute(
+ "INSERT INTO message VALUES ('zen',?1,?2)",
+ rusqlite::params![
+ now.timestamp_millis(),
+ r#"{"role":"assistant","providerID":"opencode","cost":0.25}"#
+ ],
+ )?;
+ let before = std::fs::read(&path)?;
+ db.execute_batch("BEGIN IMMEDIATE")?;
+ assert_eq!(
+ local_spend(&path, now)?.map(LocalSpend::amount).as_deref(),
+ Some("$0.25")
+ );
+ db.execute_batch("ROLLBACK")?;
+ assert_eq!(std::fs::read(&path)?, before);
+ assert!(local_spend(&root.join("missing.db"), now)?.is_none());
+ assert!(!root.join("missing.db").exists());
+ Ok(())
+ })();
+ std::fs::remove_dir_all(&root)?;
+ result
+ }
+}
diff --git a/crates/muelle-config/src/lib.rs b/crates/muelle-config/src/lib.rs
index 5a6bb92..c8e5588 100644
--- a/crates/muelle-config/src/lib.rs
+++ b/crates/muelle-config/src/lib.rs
@@ -190,7 +190,7 @@ impl Default for Config {
menu_bar_search: None,
menu_bar_task_view: None,
menu_bar_widgets: None,
- menu_bar_bluetooth: true,
+ menu_bar_bluetooth: false,
menu_bar_battery_percent: None,
show_indicators: true,
show_recents: true,
diff --git a/crates/muelle-core/src/attention.rs b/crates/muelle-core/src/attention.rs
new file mode 100644
index 0000000..7854cdf
--- /dev/null
+++ b/crates/muelle-core/src/attention.rs
@@ -0,0 +1,71 @@
+//! Pending native attention requests, not unread-message counts. Each window
+//! owns its request; focusing one never acknowledges another window's request.
+
+use std::collections::HashSet;
+
+#[derive(Default)]
+pub struct Attention {
+ pending: HashSet<isize>,
+}
+
+impl Attention {
+ pub fn request(&mut self, window: isize, foreground: isize) -> bool {
+ window != 0 && window != foreground && self.pending.insert(window)
+ }
+
+ pub fn acknowledge(&mut self, window: isize) -> bool {
+ self.pending.remove(&window)
+ }
+
+ pub fn contains(&self, window: isize) -> bool {
+ self.pending.contains(&window)
+ }
+
+ pub fn retain(&mut self, mut alive: impl FnMut(isize) -> bool) -> bool {
+ let before = self.pending.len();
+ self.pending.retain(|&window| alive(window));
+ before != self.pending.len()
+ }
+
+ pub fn clear(&mut self) {
+ self.pending.clear();
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn requests_are_idempotent_and_never_count_events_as_messages() {
+ let mut attention = Attention::default();
+ assert!(attention.request(7, 2));
+ assert!(!attention.request(7, 2));
+ assert!(attention.contains(7));
+ assert!(!attention.request(2, 2));
+ assert!(!attention.request(0, 2));
+ }
+
+ #[test]
+ fn activating_one_window_leaves_the_others_request_pending() {
+ let mut attention = Attention::default();
+ attention.request(7, 2);
+ attention.request(8, 2);
+ assert!(attention.acknowledge(7));
+ assert!(!attention.contains(7));
+ assert!(attention.contains(8));
+ }
+
+ #[test]
+ fn closed_windows_and_disabling_badges_leave_no_stale_requests() {
+ let mut attention = Attention::default();
+ attention.request(7, 2);
+ attention.request(8, 2);
+ assert!(attention.retain(|window| window == 8));
+ assert!(!attention.contains(7));
+ assert!(!attention.retain(|window| window == 8));
+ attention.clear();
+ assert!(!attention.contains(8));
+ assert!(!attention.acknowledge(8));
+ }
+}
diff --git a/crates/muelle-core/src/lib.rs b/crates/muelle-core/src/lib.rs
index 834e76b..a87dadc 100644
--- a/crates/muelle-core/src/lib.rs
+++ b/crates/muelle-core/src/lib.rs
@@ -1,5 +1,6 @@
//! Platform-independent dock logic that can be tested without Windows.
+pub mod attention;
pub mod bounce;
pub mod genie;
pub mod layout;
diff --git a/crates/muelle-core/src/roster.rs b/crates/muelle-core/src/roster.rs
index 9409128..bd42df1 100644
--- a/crates/muelle-core/src/roster.rs
+++ b/crates/muelle-core/src/roster.rs
@@ -331,6 +331,15 @@ impl Roster {
&self.recent
}
+ /// Takes `id` out of the recent apps (the user dismissed it, or it was
+ /// uninstalled). Opening and closing it again makes it recent again.
+ /// Returns whether it was there.
+ pub fn forget_recent(&mut self, id: &str) -> bool {
+ let before = self.recent.len();
+ self.recent.retain(|recent| recent != id);
+ self.recent.len() != before
+ }
+
/// Pinned items and open apps in display order, with pinned items first.
/// A group is running when any of its apps is.
#[must_use]
@@ -514,6 +523,21 @@ mod tests {
assert!(roster.recent().is_empty());
}
+ #[test]
+ fn forgetting_a_recent_app_removes_only_it_until_it_closes_again() {
+ let mut roster = roster();
+ for app in ["a", "b"] {
+ roster.sync([app]);
+ roster.sync([]);
+ }
+ assert!(roster.forget_recent("a"));
+ assert!(!roster.forget_recent("a"));
+ assert_eq!(roster.recent(), ["b"]);
+ roster.sync(["a"]);
+ roster.sync([]);
+ assert_eq!(roster.recent(), ["a", "b"]);
+ }
+
#[test]
fn sync_should_report_change_when_recent_changes() {
let mut roster = roster();
diff --git a/crates/muelle-shell/src/status.rs b/crates/muelle-shell/src/status.rs
index 2061f76..66176de 100644
--- a/crates/muelle-shell/src/status.rs
+++ b/crates/muelle-shell/src/status.rs
@@ -372,6 +372,13 @@ pub fn taskbar_buttons() -> TaskbarButtons {
}
}
+/// The user's native taskbar badge preference. An unset value uses Windows'
+/// default (enabled); the dock never writes or overrides this preference.
+#[must_use]
+pub fn taskbar_badges_enabled() -> bool {
+ dword(ADVANCED, "TaskbarBadges").unwrap_or(1) != 0
+}
+
/// Windows Settings → System → Power & battery → Battery percentage.
/// Missing or unreadable means off, matching the Windows default. Read-only:
/// the user's preference remains owned by Windows, including on older builds.
diff --git a/muelle/astro.config.mjs b/muelle/astro.config.mjs
index ba824e8..5b950f1 100644
--- a/muelle/astro.config.mjs
+++ b/muelle/astro.config.mjs
@@ -5,7 +5,7 @@ import tailwindcss from "@tailwindcss/vite";
export default defineConfig({
// Feeds the canonical URLs and the sitemap. Keep in sync with `site.url`.
- site: "https://muellee.vercel.app",
+ site: "https://muelle.crafter.run",
// The 404 page must stay out: a sitemap lists canonical, indexable URLs only.
integrations: [sitemap({ filter: (page) => !page.endsWith("/404") })],
vite: {
diff --git a/muelle/public/llms.txt b/muelle/public/llms.txt
index 418b074..546a49f 100644
--- a/muelle/public/llms.txt
+++ b/muelle/public/llms.txt
@@ -6,14 +6,14 @@ Muelle is not an Electron app: the dock is a native Win32 process that draws thr
## Pages
-- [Home](https://muellee.vercel.app/): what Muelle is and how it looks.
-- [The Dock](https://muellee.vercel.app/#dock): the parts of the dock and what each one does.
-- [AI usage](https://muellee.vercel.app/#ai-usage): provider limits and Gemini Pro/Flash quota examples.
-- [Settings](https://muellee.vercel.app/#customize): an interactive replica of the Settings app.
-- [Reversible](https://muellee.vercel.app/#safety): how the Windows taskbar comes back.
-- [Download](https://muellee.vercel.app/#download): installer and build from source.
-- [Privacy policy](https://muellee.vercel.app/privacy): what Muelle sends over the network and what stays on the PC.
-- [Code signing policy](https://muellee.vercel.app/code-signing-policy): how releases are built and signed.
+- [Home](https://muelle.crafter.run/): what Muelle is and how it looks.
+- [The Dock](https://muelle.crafter.run/#dock): the parts of the dock and what each one does.
+- [AI usage](https://muelle.crafter.run/#ai-usage): provider limits and Gemini Pro/Flash quota examples.
+- [Settings](https://muelle.crafter.run/#customize): an interactive replica of the Settings app.
+- [Reversible](https://muelle.crafter.run/#safety): how the Windows taskbar comes back.
+- [Download](https://muelle.crafter.run/#download): installer and build from source.
+- [Privacy policy](https://muelle.crafter.run/privacy): what Muelle sends over the network and what stays on the PC.
+- [Code signing policy](https://muelle.crafter.run/code-signing-policy): how releases are built and signed.
## Download
diff --git a/muelle/public/robots.txt b/muelle/public/robots.txt
index 9ffcf03..ce6054c 100644
--- a/muelle/public/robots.txt
+++ b/muelle/public/robots.txt
@@ -14,4 +14,4 @@ Allow: /
User-agent: PerplexityBot
Allow: /
-Sitemap: https://muellee.vercel.app/sitemap-index.xml
+Sitemap: https://muelle.crafter.run/sitemap-index.xml
diff --git a/muelle/src/data/site.ts b/muelle/src/data/site.ts
index e2ed07b..eeccaee 100644
--- a/muelle/src/data/site.ts
+++ b/muelle/src/data/site.ts
@@ -1,14 +1,9 @@
-/** Links point at the public repository. `download` always serves the newest
- * published release (the release workflow attaches a stable Muelle-Setup.exe). */
export const site = {
name: "Muelle",
tagline: "The macOS Dock, made for Windows.",
- /** Kept concise for search snippets while naming the supported Windows versions. */
description:
"Free, open-source macOS-style dock for Windows 10 and 11. Genie animations, window previews, AI usage and optional accessory battery indicators.",
- /** Canonical origin. Must match `site` in astro.config.mjs and the sitemap. */
- url: "https://muellee.vercel.app",
- /** Path to the social card in `public/`. */
+ url: "https://muelle.crafter.run",
ogImage: "/og-image.png",
ogImageWidth: 1200,
ogImageHeight: 630,
diff --git a/packaging/winget/manifests/c/CrafterStation/Muelle/0.1.16/CrafterStation.Muelle.locale.en-US.yaml b/packaging/winget/manifests/c/CrafterStation/Muelle/0.1.16/CrafterStation.Muelle.locale.en-US.yaml
index afca39a..360f01f 100644
--- a/packaging/winget/manifests/c/CrafterStation/Muelle/0.1.16/CrafterStation.Muelle.locale.en-US.yaml
+++ b/packaging/winget/manifests/c/CrafterStation/Muelle/0.1.16/CrafterStation.Muelle.locale.en-US.yaml
@@ -5,9 +5,9 @@ PackageLocale: en-US
Publisher: Muelle
PublisherUrl: https://github.com/crafter-station
PublisherSupportUrl: https://github.com/crafter-station/Muelle/issues
-PrivacyUrl: https://muellee.vercel.app/privacy
+PrivacyUrl: https://muelle.crafter.run/privacy
PackageName: Muelle
-PackageUrl: https://muellee.vercel.app
+PackageUrl: https://muelle.crafter.run
License: MIT
LicenseUrl: https://github.com/crafter-station/Muelle/blob/main/LICENSE
ShortDescription: A macOS-style dock and menu bar for Windows 10 and 11.
diff --git a/packaging/winget/manifests/c/CrafterStation/Muelle/0.1.17/CrafterStation.Muelle.locale.en-US.yaml b/packaging/winget/manifests/c/CrafterStation/Muelle/0.1.17/CrafterStation.Muelle.locale.en-US.yaml
index 3cf629e..4adb12b 100644
--- a/packaging/winget/manifests/c/CrafterStation/Muelle/0.1.17/CrafterStation.Muelle.locale.en-US.yaml
+++ b/packaging/winget/manifests/c/CrafterStation/Muelle/0.1.17/CrafterStation.Muelle.locale.en-US.yaml
@@ -5,9 +5,9 @@ PackageLocale: en-US
Publisher: Muelle
PublisherUrl: https://github.com/crafter-station
PublisherSupportUrl: https://github.com/crafter-station/Muelle/issues
-PrivacyUrl: https://muellee.vercel.app/privacy
+PrivacyUrl: https://muelle.crafter.run/privacy
PackageName: Muelle
-PackageUrl: https://muellee.vercel.app
+PackageUrl: https://muelle.crafter.run
License: MIT
LicenseUrl: https://github.com/crafter-station/Muelle/blob/main/LICENSE
ShortDescription: A macOS-style dock and menu bar for Windows 10 and 11.
diff --git a/packaging/winget/manifests/c/CrafterStation/Muelle/0.1.5/CrafterStation.Muelle.locale.en-US.yaml b/packaging/winget/manifests/c/CrafterStation/Muelle/0.1.5/CrafterStation.Muelle.locale.en-US.yaml
index f599ca4..52206ee 100644
--- a/packaging/winget/manifests/c/CrafterStation/Muelle/0.1.5/CrafterStation.Muelle.locale.en-US.yaml
+++ b/packaging/winget/manifests/c/CrafterStation/Muelle/0.1.5/CrafterStation.Muelle.locale.en-US.yaml
@@ -5,9 +5,9 @@ PackageLocale: en-US
Publisher: Crafter Station
PublisherUrl: https://github.com/crafter-station
PublisherSupportUrl: https://github.com/crafter-station/Muelle/issues
-PrivacyUrl: https://muellee.vercel.app/privacy
+PrivacyUrl: https://muelle.crafter.run/privacy
PackageName: Muelle
-PackageUrl: https://muellee.vercel.app
+PackageUrl: https://muelle.crafter.run
License: MIT
LicenseUrl: https://github.com/crafter-station/Muelle/blob/main/LICENSE
ShortDescription: The macOS Dock, made for Windows 11.
diff --git a/packaging/winget/templates/CrafterStation.Muelle.locale.en-US.yaml b/packaging/winget/templates/CrafterStation.Muelle.locale.en-US.yaml
index 939e6ac..bb026eb 100644
--- a/packaging/winget/templates/CrafterStation.Muelle.locale.en-US.yaml
+++ b/packaging/winget/templates/CrafterStation.Muelle.locale.en-US.yaml
@@ -5,9 +5,9 @@ PackageLocale: en-US
Publisher: Muelle
PublisherUrl: https://github.com/crafter-station
PublisherSupportUrl: https://github.com/crafter-station/Muelle/issues
-PrivacyUrl: https://muellee.vercel.app/privacy
+PrivacyUrl: https://muelle.crafter.run/privacy
PackageName: Muelle
-PackageUrl: https://muellee.vercel.app
+PackageUrl: https://muelle.crafter.run
License: MIT
LicenseUrl: https://github.com/crafter-station/Muelle/blob/main/LICENSE
ShortDescription: A macOS-style dock and menu bar for Windows 10 and 11.