A lightweight, macOS-style dock for Windows 11, with glass visuals, smooth magnification, and Genie effect.
Refactor usage of Cursor provider: remove references and assets
CristianOlivera1e347b95d1c5f
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 5d39a3d..4423091 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,15 @@ copia la sección de la versión que se publica a la release de GitHub.### English+- Fixed: some antivirus programs flagged Muelle 0.1.6–0.1.8 as a trojan and+ deleted it, often right after updating. Two things looked like malware: to+ show GitHub Copilot and Cursor usage, Muelle decrypted VS Code's stored+ secrets and read Cursor's database (what password stealers do), and since+ 0.1.7 it set itself up to start with Windows by running `schtasks.exe`+ hidden. Muelle no longer does either: it starts from the usual `Run`+ registry entry (an existing startup task is moved there once), Copilot+ usage comes only from the Copilot CLI sign-in or `GH_TOKEN`/`GITHUB_TOKEN`,+ and Cursor usage was removed. The dock is also 28% smaller.- Fixed: after choosing an item in the dock's menu (Muelle Settings, forone), the dock could stay magnified and stop reacting to the pointer.- Alt+Tab: the hidden dock shows only for Alt+Tab, no longer for Task View,@@ -31,6 +40,16 @@ copia la sección de la versión que se publica a la release de GitHub.### Español+- Corregido: algunos antivirus marcaban Muelle 0.1.6–0.1.8 como troyano y lo+ borraban, a menudo justo al actualizar. Dos cosas parecían malware: para+ mostrar el uso de GitHub Copilot y Cursor, Muelle descifraba los secretos+ guardados de VS Code y leía la base de datos de Cursor (lo que hacen los+ ladrones de contraseñas), y desde la 0.1.7 se configuraba para iniciar con+ Windows ejecutando `schtasks.exe` oculto. Muelle ya no hace ninguna de las+ dos: arranca desde la entrada habitual `Run` del registro (una tarea de+ inicio existente se traslada ahí una vez), el uso de Copilot sale solo de la+ sesión de Copilot CLI o de `GH_TOKEN`/`GITHUB_TOKEN`, y se quitó el uso de+ Cursor. Además, el dock ocupa un 28 % menos.- Corregido: tras elegir una opción del menú del dock (por ejemplo, Ajustesde Muelle), el dock podía quedarse ampliado y dejar de responder al puntero.- Alt+Tab: el dock oculto aparece solo con Alt+Tab, ya no con la Vista dediff --git a/Cargo.lock b/Cargo.lockindex ee86d53..dc14b5c 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -8,41 +8,6 @@ version = "2.0.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"-[[package]]-name = "aead"-version = "0.5.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0"-dependencies = [- "crypto-common",- "generic-array",-]--[[package]]-name = "aes"-version = "0.8.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"-dependencies = [- "cfg-if",- "cipher",- "cpufeatures 0.2.17",-]--[[package]]-name = "aes-gcm"-version = "0.10.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1"-dependencies = [- "aead",- "aes",- "cipher",- "ctr",- "ghash",- "subtle",-]-[[package]]name = "aho-corasick"version = "1.1.5"@@ -549,7 +514,7 @@ checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06"dependencies = ["cfg-if","cpufeatures 0.3.1",- "rand_core 0.10.1",+ "rand_core",][[package]]@@ -564,16 +529,6 @@ dependencies = ["windows-link",]-[[package]]-name = "cipher"-version = "0.4.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"-dependencies = [- "crypto-common",- "inout",-]-[[package]]name = "cmake"version = "0.1.58"@@ -720,7 +675,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"dependencies = ["generic-array",- "rand_core 0.6.4","typenum",]@@ -766,15 +720,6 @@ version = "1.0.13"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "914a755b7c2d4af2bdcff7ce1739e2db9a1b81a9b07123d8015786ae03c0980d"-[[package]]-name = "ctr"-version = "0.9.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835"-dependencies = [- "cipher",-]-[[package]]name = "darling"version = "0.24.1"@@ -935,7 +880,7 @@ checksum = "fac5fca71e65e94cc718a6e2af65d6e0f9c6027751c2aa562fbb5087fda639bc"dependencies = ["bit-set 0.8.0","cssparser 0.37.0",- "foldhash 0.2.0",+ "foldhash","html5ever 0.39.0","precomputed-hash","selectors 0.38.0",@@ -950,7 +895,7 @@ checksum = "498c698ac51127148a3984450e51fca7f01805a91d7a1f7a24af0a5f761e3385"dependencies = ["bit-set 0.11.1","cssparser 0.38.0",- "foldhash 0.2.0",+ "foldhash","html5ever 0.40.1","precomputed-hash","selectors 0.41.0",@@ -1087,18 +1032,6 @@ 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"@@ -1157,12 +1090,6 @@ version = "1.0.7"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"-[[package]]-name = "foldhash"-version = "0.1.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"-[[package]]name = "foldhash"version = "0.2.0"@@ -1440,20 +1367,10 @@ dependencies = ["js-sys","libc","r-efi 6.0.0",- "rand_core 0.10.1",+ "rand_core","wasm-bindgen",]-[[package]]-name = "ghash"-version = "0.5.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1"-dependencies = [- "opaque-debug",- "polyval",-]-[[package]]name = "gio"version = "0.18.4"@@ -1608,30 +1525,12 @@ version = "0.12.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"-[[package]]-name = "hashbrown"-version = "0.15.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"-dependencies = [- "foldhash 0.1.5",-]-[[package]]name = "hashbrown"version = "0.17.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"-[[package]]-name = "hashlink"-version = "0.10.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1"-dependencies = [- "hashbrown 0.15.5",-]-[[package]]name = "heck"version = "0.4.1"@@ -1952,15 +1851,6 @@ dependencies = ["cfb",]-[[package]]-name = "inout"-version = "0.1.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01"-dependencies = [- "generic-array",-]-[[package]]name = "ipnet"version = "2.12.2"@@ -2233,17 +2123,6 @@ dependencies = ["libc",]-[[package]]-name = "libsqlite3-sys"-version = "0.35.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "133c182a6a2c87864fe97778797e46c7e999672690dc9fa3ee8e241aa4a9c13f"-dependencies = [- "cc",- "pkg-config",- "vcpkg",-]-[[package]]name = "linux-raw-sys"version = "0.12.1"@@ -2382,7 +2261,6 @@ dependencies = [name = "muelle"version = "0.1.8"dependencies = [- "aes-gcm","anyhow","base64 0.22.1","chrono",@@ -2391,7 +2269,6 @@ dependencies = ["muelle-shell","png","reqwest",- "rusqlite","serde","serde_json","windows",@@ -2736,12 +2613,6 @@ version = "1.21.4"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"-[[package]]-name = "opaque-debug"-version = "0.3.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"-[[package]]name = "openssl-probe"version = "0.2.2"@@ -3007,18 +2878,6 @@ dependencies = ["windows-sys 0.61.2",]-[[package]]-name = "polyval"-version = "0.6.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25"-dependencies = [- "cfg-if",- "cpufeatures 0.2.17",- "opaque-debug",- "universal-hash",-]-[[package]]name = "portable-atomic"version = "1.15.0"@@ -3212,16 +3071,7 @@ checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af"dependencies = ["chacha20","getrandom 0.4.3",- "rand_core 0.10.1",-]--[[package]]-name = "rand_core"-version = "0.6.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"-dependencies = [- "getrandom 0.2.17",+ "rand_core",][[package]]@@ -3236,7 +3086,7 @@ version = "0.10.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a"dependencies = [- "rand_core 0.10.1",+ "rand_core",][[package]]@@ -3368,20 +3218,6 @@ dependencies = ["windows-sys 0.52.0",]-[[package]]-name = "rusqlite"-version = "0.37.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "165ca6e57b20e1351573e3729b958bc62f0e48025386970b6e4d29e7a7e71f3f"-dependencies = [- "bitflags 2.13.2",- "fallible-iterator",- "fallible-streaming-iterator",- "hashlink",- "libsqlite3-sys",- "smallvec",-]-[[package]]name = "rustc-hash"version = "2.1.3"@@ -4843,16 +4679,6 @@ version = "1.13.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8"-[[package]]-name = "universal-hash"-version = "0.5.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea"-dependencies = [- "crypto-common",- "subtle",-]-[[package]]name = "untrusted"version = "0.9.0"@@ -4911,12 +4737,6 @@ 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.mdindex 6427020..4cfa791 100644--- a/README.es.md+++ b/README.es.md@@ -30,7 +30,7 @@ en desarrollo activo.además de los botones de búsqueda, Vista de tareas y Widgets si los tienes en la barrade Windows.- Una isla curva en la barra superior con los límites de Claude Code, Codex,- GitHub Copilot, Cursor, OpenCode Go, Gemini CLI y Antigravity. Las cuotas de+ GitHub Copilot, OpenCode Go, Gemini CLI y Antigravity. Las cuotas deGemini Pro y Flash aparecen por separado cuando están disponibles.- App de Ajustes aparte, con cambios en vivo, en español e inglés, y efecto genio configurable.- Un proceso guardián devuelve la barra de tareas de Windows si el dock se cierra de forma inesperada.diff --git a/README.md b/README.mdindex f4f6931..a04cb5b 100644--- a/README.md+++ b/README.md@@ -36,7 +36,7 @@ Smooth magnification, live window previews, and an optional Genie-style minimizeinput language, microphone/camera in use, the hidden tray icons, plusthe Search, Task View and Widgets buttons if you have them on the Windows taskbar.- A curved island in the menu bar for usage limits from Claude Code, Codex,- GitHub Copilot, Cursor, OpenCode Go, Gemini CLI, and Antigravity. Gemini Pro+ GitHub Copilot, OpenCode Go, Gemini CLI, and Antigravity. Gemini Proand Flash quotas appear separately when available.- Separate Settings app with live changes, Spanish and English, and aconfigurable Genie-style minimize animation.diff --git a/apps/dock/Cargo.toml b/apps/dock/Cargo.tomlindex 4b66ade..2e7e51b 100644--- a/apps/dock/Cargo.toml+++ b/apps/dock/Cargo.toml@@ -12,7 +12,6 @@ winresource = "0.1"[dependencies]anyhow.workspace = true-aes-gcm = "0.10"base64 = "0.22"chrono = { version = "0.4", default-features = false, features = ["clock", "std", "serde"] }muelle-config.workspace = true@@ -20,7 +19,6 @@ muelle-core.workspace = truemuelle-shell.workspace = truepng = "0.18"reqwest = { version = "0.13", default-features = false, features = ["blocking", "rustls", "system-proxy"] }-rusqlite = { version = "0.37", features = ["bundled"] }serde.workspace = trueserde_json = "1"windows-core.workspace = true@@ -45,7 +43,6 @@ windows = { workspace = true, features = ["Win32_Graphics_Gdi","Win32_Security","Win32_Security_Credentials",- "Win32_Security_Cryptography","Win32_System_Com","Win32_System_Diagnostics_ToolHelp","Win32_System_Console",diff --git a/apps/dock/src/menubar.rs b/apps/dock/src/menubar.rsindex 32b0b35..2296906 100644--- a/apps/dock/src/menubar.rs+++ b/apps/dock/src/menubar.rs@@ -1621,7 +1621,6 @@ impl MenuBar {Provider::Claude => rgba(217, 119, 87, 255),Provider::Codex => rgba(135, 190, 245, 255),Provider::Copilot => rgba(147, 164, 186, 255),- Provider::Cursor => rgba(174, 180, 189, 255),Provider::OpenCode => rgba(132, 196, 166, 255),Provider::Gemini => rgba(111, 146, 255, 255),};diff --git a/apps/dock/src/usage.rs b/apps/dock/src/usage.rsindex d18a297..d52d21b 100644--- a/apps/dock/src/usage.rs+++ b/apps/dock/src/usage.rs@@ -14,19 +14,14 @@ use std::{time::{Duration, Instant, SystemTime, UNIX_EPOCH},};-use aes_gcm::{Aes256Gcm, KeyInit, Nonce, aead::Aead};use chrono::{DateTime, Local, NaiveDate, Utc};use muelle_shell::icons::IconImage;use reqwest::blocking::Client;-use rusqlite::{Connection, OpenFlags};use serde::{Deserialize, Serialize};use serde_json::Value;use windows::Win32::{- Foundation::{CloseHandle, HLOCAL, HWND, LPARAM, LocalFree, WPARAM},- Security::{- Credentials::{CRED_TYPE_GENERIC, CREDENTIALW, CredFree, CredReadW},- Cryptography::{CRYPT_INTEGER_BLOB, CryptUnprotectData},- },+ Foundation::{CloseHandle, HWND, LPARAM, WPARAM},+ Security::Credentials::{CRED_TYPE_GENERIC, CREDENTIALW, CredFree, CredReadW},System::Diagnostics::ToolHelp::{CreateToolhelp32Snapshot, PROCESSENTRY32W, Process32FirstW, Process32NextW,TH32CS_SNAPPROCESS,@@ -123,18 +118,16 @@ pub enum Provider {Claude,Codex,Copilot,- Cursor,OpenCode,Gemini,}impl Provider {- pub const COUNT: usize = 6;+ pub const COUNT: usize = 5;pub const ALL: [Self; Self::COUNT] = [Self::Claude,Self::Codex,Self::Copilot,- Self::Cursor,Self::OpenCode,Self::Gemini,];@@ -144,7 +137,6 @@ impl Provider {Self::Claude => "Claude",Self::Codex => "Codex",Self::Copilot => "Copilot",- Self::Cursor => "Cursor",Self::OpenCode => "OpenCode",Self::Gemini => "Gemini",}@@ -196,7 +188,6 @@ pub fn active_providers() -> ActiveProviders {Some(Provider::Copilot)}"copilot-runtime.exe" => Some(Provider::Copilot),- "cursor.exe" | "cursor-agent.exe" => Some(Provider::Cursor),"opencode.exe" => Some(Provider::OpenCode),"gemini.exe" | "antigravity.exe" | "agy.exe" => Some(Provider::Gemini),_ => None,@@ -252,7 +243,6 @@ pub fn logo(provider: Provider) -> Option<&'static IconImage> {static CLAUDE: std::sync::OnceLock<Option<IconImage>> = std::sync::OnceLock::new();static CODEX: std::sync::OnceLock<Option<IconImage>> = std::sync::OnceLock::new();static COPILOT: std::sync::OnceLock<Option<IconImage>> = std::sync::OnceLock::new();- static CURSOR: std::sync::OnceLock<Option<IconImage>> = std::sync::OnceLock::new();static OPENCODE: std::sync::OnceLock<Option<IconImage>> = std::sync::OnceLock::new();static GEMINI: std::sync::OnceLock<Option<IconImage>> = std::sync::OnceLock::new();match provider {@@ -265,9 +255,6 @@ pub fn logo(provider: Provider) -> Option<&'static IconImage> {Provider::Copilot => COPILOT.get_or_init(|| decode_logo(include_bytes!("../../../assets/usage/copilot.png"))).as_ref(),- Provider::Cursor => CURSOR- .get_or_init(|| decode_logo(include_bytes!("../../../assets/usage/cursor.png")))- .as_ref(),Provider::OpenCode => OPENCODE.get_or_init(|| decode_logo(include_bytes!("../../../assets/usage/opencode.png"))).as_ref(),@@ -434,7 +421,6 @@ fn fetch_all() -> Snapshot {Provider::Claude => fetch_claude(&client),Provider::Codex => fetch_codex(&client),Provider::Copilot => fetch_copilot(&client),- Provider::Cursor => fetch_cursor(&client),Provider::OpenCode => fetch_opencode(&client),Provider::Gemini => fetch_gemini(&client),}@@ -497,122 +483,6 @@ fn credential_text(target: windows::core::PCWSTR) -> Option<String> {token.map(|value| value.trim_matches('\0').trim().to_owned())}-fn vscode_github_tokens() -> Vec<String> {- let Some(root) = home() else {- return Vec::new();- };- let Some(profile) = env::var_os("APPDATA").map(PathBuf::from) else {- return Vec::new();- };- let key_file = profile.join("Code/Local State");- let Ok(key_file) = fs::read(key_file) else {- return Vec::new();- };- let Ok(key_json) = serde_json::from_slice::<Value>(&key_file) else {- return Vec::new();- };- let Some(key_b64) = key_json- .pointer("/os_crypt/encrypted_key")- .and_then(Value::as_str)- else {- return Vec::new();- };- use base64::Engine;- let Ok(wrapped) = base64::engine::general_purpose::STANDARD.decode(key_b64) else {- return Vec::new();- };- let Some(wrapped) = wrapped.strip_prefix(b"DPAPI") else {- return Vec::new();- };- let Some(key) = dpapi_unprotect(wrapped) else {- return Vec::new();- };- let db_path = root.join(".vscode-shared/sharedStorage/state.vscdb");- let Ok(db) = Connection::open_with_flags(db_path, OpenFlags::SQLITE_OPEN_READ_ONLY) else {- return Vec::new();- };- let Ok(blob) = db.query_row(- "SELECT value FROM ItemTable WHERE key = ?1 LIMIT 1",- [r#"secret://{"extensionId":"vscode.github-authentication","key":"github.auth"}"#],- |row| row.get::<_, String>(0),- ) else {- return Vec::new();- };- let Ok(wrapper) = serde_json::from_str::<Value>(&blob) else {- return Vec::new();- };- let Some(bytes) = wrapper.get("data").and_then(Value::as_array) else {- return Vec::new();- };- let Some(encrypted) = bytes- .iter()- .map(|value| value.as_u64().and_then(|byte| u8::try_from(byte).ok()))- .collect::<Option<Vec<_>>>()- else {- return Vec::new();- };- if encrypted.len() < 3 + 12 + 16 || !encrypted.starts_with(b"v10") {- return Vec::new();- }- let Ok(cipher) = Aes256Gcm::new_from_slice(&key) else {- return Vec::new();- };- let Ok(plain) = cipher.decrypt(Nonce::from_slice(&encrypted[3..15]), &encrypted[15..]) else {- return Vec::new();- };- let Ok(sessions) = serde_json::from_slice::<Value>(&plain) else {- return Vec::new();- };- let mut tokens = Vec::new();- collect_github_tokens(&sessions, &mut tokens);- tokens-}--fn dpapi_unprotect(encrypted: &[u8]) -> Option<Vec<u8>> {- let input = CRYPT_INTEGER_BLOB {- cbData: u32::try_from(encrypted.len()).ok()?,- pbData: encrypted.as_ptr().cast_mut(),- };- let mut output = CRYPT_INTEGER_BLOB::default();- // SAFETY: Both blobs have valid buffers; Windows owns and frees the output.- unsafe { CryptUnprotectData(&input, None, None, None, None, 0, &mut output).ok()? };- if output.pbData.is_null() {- return None;- }- // SAFETY: CryptUnprotectData returned `cbData` bytes at `pbData`.- let plain =- unsafe { std::slice::from_raw_parts(output.pbData, output.cbData as usize).to_vec() };- // SAFETY: CryptUnprotectData allocated this buffer with LocalAlloc.- unsafe {- let _ = LocalFree(Some(HLOCAL(output.pbData.cast())));- }- Some(plain)-}--fn collect_github_tokens(value: &Value, tokens: &mut Vec<String>) {- match value {- Value::Object(object) => {- if let Some(token) = object- .get("accessToken")- .or_else(|| object.get("access_token"))- .and_then(Value::as_str)- .filter(|token| token.starts_with("gh") && token.len() < 512)- {- tokens.push(token.to_owned());- }- for item in object.values() {- collect_github_tokens(item, tokens);- }- }- Value::Array(items) => {- for item in items {- collect_github_tokens(item, tokens);- }- }- _ => {}- }-}-fn fetch_claude(client: &Client) -> ProviderUsage {let Some(root) = env::var_os("CLAUDE_CONFIG_DIR").map(PathBuf::from)@@ -704,7 +574,7 @@ fn fetch_codex(client: &Client) -> ProviderUsage {}fn fetch_copilot(client: &Client) -> ProviderUsage {- let mut tokens = [+ let tokens = [env::var("COPILOT_GITHUB_TOKEN").ok(),env::var("GH_TOKEN").ok(),env::var("GITHUB_TOKEN").ok(),@@ -714,7 +584,6 @@ fn fetch_copilot(client: &Client) -> ProviderUsage {.into_iter().flatten().collect::<Vec<_>>();- tokens.extend(vscode_github_tokens());for token in tokens.into_iter().filter(|value| !value.is_empty()) {let response = client.get("https://api.github.com/copilot_internal/user")@@ -795,116 +664,6 @@ fn parse_copilot(value: &Value) -> Vec<Window> {.collect()}-fn fetch_cursor(client: &Client) -> ProviderUsage {- let Some(path) = env::var_os("APPDATA")- .map(PathBuf::from)- .map(|path| path.join("Cursor/User/globalStorage/state.vscdb"))- else {- return sign_in();- };- if !path.is_file() {- return sign_in();- }- let Ok(db) = Connection::open_with_flags(path, OpenFlags::SQLITE_OPEN_READ_ONLY) else {- return unavailable();- };- let Ok(token) = db.query_row(- "SELECT value FROM ItemTable WHERE key = 'cursorAuth/accessToken' LIMIT 1",- [],- |row| row.get::<_, String>(0),- ) else {- return sign_in();- };- let Some(cookie) = cursor_cookie(&token) else {- return sign_in();- };- let Ok(response) = client- .get("https://cursor.com/api/usage-summary")- .header("Cookie", cookie)- .header("Accept", "application/json")- .send()- else {- return unavailable();- };- if matches!(response.status().as_u16(), 401 | 403) {- return sign_in();- }- let Ok(body) = response- .error_for_status()- .and_then(|response| response.text())- else {- return unavailable();- };- let Ok(value) = serde_json::from_str::<Value>(&body) else {- return unavailable();- };- let windows = parse_cursor(&value);- if windows.is_empty() {- unavailable()- } else {- ready(windows)- }-}--fn cursor_cookie(token: &str) -> Option<String> {- use base64::Engine;- let parts = token.split('.').collect::<Vec<_>>();- let payload = parts.get(1)?;- let decoded = base64::engine::general_purpose::URL_SAFE_NO_PAD- .decode(payload)- .ok()?;- let claims = serde_json::from_slice::<Value>(&decoded).ok()?;- let expiry = claims.get("exp")?.as_i64()?;- if expiry < Utc::now().timestamp() + 60 {- return None;- }- let user = claims.get("sub")?.as_str()?.rsplit('|').next()?;- if user.is_empty()- || !user- .bytes()- .all(|byte| byte.is_ascii_alphanumeric() || b"._-".contains(&byte))- {- return None;- }- Some(format!("WorkosCursorSessionToken={user}%3A%3A{token}"))-}--fn parse_cursor(value: &Value) -> Vec<Window> {- let plan = value- .pointer("/individualUsage/plan")- .or_else(|| value.pointer("/individual_usage/plan"));- let Some(plan) = plan else {- return Vec::new();- };- let used = plan.get("totalPercentUsed").and_then(percent).or_else(|| {- let amount = plan.get("used")?.as_f64()?;- let limit = plan.get("limit")?.as_f64()?;- (limit > 0.0).then(|| (amount * 100.0 / limit).clamp(0.0, 100.0).round() as u8)- });- let Some(used_percent) = used else {- return Vec::new();- };- let resets_at = value- .get("billingCycleEnd")- .and_then(Value::as_str)- .and_then(|text| DateTime::parse_from_rfc3339(text).ok())- .map(|date| date.with_timezone(&Utc));- let minutes = value- .get("billingCycleStart")- .and_then(Value::as_str)- .and_then(|text| DateTime::parse_from_rfc3339(text).ok())- .zip(resets_at)- .map_or(30 * 24 * 60, |(start, end)| {- (end.signed_duration_since(start).num_minutes()).max(1)- });- vec![Window {- label: None,- minutes,- used_percent,- resets_at,- }]-}-fn fetch_opencode(client: &Client) -> ProviderUsage {let Some(path) = home().map(|path| path.join(".local/share/opencode/auth.json")) else {return sign_in();@@ -1476,35 +1235,6 @@ mod tests {assert_eq!(camel[0].used_percent, 38);}- #[test]- fn github_session_parser_only_returns_tokens() {- let mut tokens = Vec::new();- collect_github_tokens(- &json!({"sessions": [- {"accessToken": "gho_test", "account": {"id": "private"}},- {"accessToken": "unrelated", "account": {"id": "private"}}- ]}),- &mut tokens,- );- assert_eq!(tokens, ["gho_test"]);- }-- #[test]- fn cursor_rejects_expired_session_and_parses_billing_cycle() {- use base64::Engine;- let claims = json!({"sub": "auth0|abc123", "exp": 1});- let payload = base64::engine::general_purpose::URL_SAFE_NO_PAD.encode(claims.to_string());- assert!(cursor_cookie(&format!("x.{payload}.y")).is_none());- let windows = parse_cursor(&json!({- "individualUsage": {"plan": {"totalPercentUsed": 45}},- "billingCycleStart": "2026-11-01T00:00:00Z",- "billingCycleEnd": "2026-12-01T00:00:00Z"- }));- assert_eq!(windows[0].used_percent, 45);- assert_eq!(windows[0].title(), "30 d");- assert!(windows[0].resets_at.is_some());- }-#[test]fn opencode_ignores_unmeasured_lanes() {let windows = parse_opencode(&json!({"usage": {diff --git a/assets/usage/cursor.png b/assets/usage/cursor.pngdeleted file mode 100644index d178288..0000000Binary files a/assets/usage/cursor.png and /dev/null differdiff --git a/assets/usage/cursor.svg b/assets/usage/cursor.svgdeleted file mode 100644index a7c96a5..0000000--- a/assets/usage/cursor.svg+++ /dev/null@@ -1,3 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 24 24">- <path fill="#f5f7fa" d="m20.42 6.73l-8-4.62a.82.82 0 0 0-.83 0L3.58 6.73c-.22.12-.35.36-.35.61v9.32c0 .25.13.48.35.61l8.01 4.62c.26.15.57.15.83 0l8.01-4.62c.22-.12.35-.36.35-.61V7.34c0-.25-.13-.48-.35-.61Zm-.5.98L12.19 21.1c-.05.09-.19.05-.19-.05v-8.77c0-.18-.09-.34-.25-.43L4.16 7.47c-.09-.05-.05-.19.05-.19h15.46c.22 0 .36.24.25.43"/>-</svg>diff --git a/crates/muelle-shell/Cargo.toml b/crates/muelle-shell/Cargo.tomlindex 0b3473e..9ac5600 100644--- a/crates/muelle-shell/Cargo.toml+++ b/crates/muelle-shell/Cargo.toml@@ -30,6 +30,7 @@ windows = { workspace = true, features = ["Win32_System_Registry","Win32_Security","Win32_System_Threading",+ "Win32_System_TaskScheduler","Win32_System_Variant","Win32_UI_HiDpi","Win32_UI_Input_KeyboardAndMouse",diff --git a/crates/muelle-shell/src/autostart.rs b/crates/muelle-shell/src/autostart.rsindex b66151a..a9de649 100644--- a/crates/muelle-shell/src/autostart.rs+++ b/crates/muelle-shell/src/autostart.rs@@ -1,16 +1,16 @@-//! Starting Muelle when the user signs in.+//! Starting Muelle when the user signs in, with the `Run` registry key: what+//! most desktop apps use, and what security software expects from them.//!-//! A scheduled task with a logon trigger, not the `Run` registry key: Windows-//! launches `Run` entries several seconds after the desktop appears, at low-//! priority, so the full Windows taskbar showed for a long while at every-//! sign-in. A logon task starts with the session. Creating one for yourself-//! needs no administrator rights.+//! Versions 0.1.7 and 0.1.8 used a logon scheduled task instead, created by+//! running `schtasks.exe` hidden. That looks like a trojan setting itself up+//! to persist, and some antivirus programs deleted Muelle for it. Those tasks+//! are moved back to `Run` once (`migrate_legacy`), deleting the task through+//! the Task Scheduler API rather than another hidden process.//!-//! Whether autostart is on is also written to `HKCU\Software\Muelle`, because-//! task registrations cannot be read without administrator rights and the-//! watchdog has to know it instantly while Windows shuts down.+//! Whether autostart is on is also written to `HKCU\Software\Muelle`, so the+//! watchdog knows it instantly while Windows shuts down.-use std::{env, fs, os::windows::process::CommandExt, path::PathBuf, process::Command};+use std::env;use windows::{Win32::{@@ -24,149 +24,80 @@ use windows::{core::{PCWSTR, w},};-/// The value Muelle used to add under `Run`, before the logon task.-const LEGACY_RUN_VALUE: PCWSTR = w!("Muelle");+const RUN_VALUE: PCWSTR = w!("Muelle");const RUN_KEY: PCWSTR = w!(r"Software\Microsoft\Windows\CurrentVersion\Run");const MUELLE_KEY: PCWSTR = w!(r"Software\Muelle");const MARKER_VALUE: PCWSTR = w!("Autostart");-/// `schtasks.exe` runs without a console window.-const CREATE_NO_WINDOW: u32 = 0x0800_0000;/// Starts `exe` at every sign-in, or stops doing so (`None`).pub fn set(exe: Option<&str>) -> windows::core::Result<()> {match exe {- Some(exe) => {- if create_task(exe) {- delete_legacy_run_value()?;- } else {- // Without the Task Scheduler service, the slower `Run` entry- // still starts the dock.- set_legacy_run_value(exe)?;- }- set_marker(true)- }+ Some(exe) => set_run_value(exe)?,None => {- delete_task();- delete_legacy_run_value()?;- set_marker(false)+ delete_run_value()?;+ // A task left by 0.1.7 or 0.1.8 must not keep starting Muelle.+ delete_legacy_task();}}+ set_marker(exe.is_some())}/// `true` if Muelle is set to start when the user signs in. Reads only the/// registry, so it is instant and works while Windows shuts down.#[must_use]pub fn is_enabled() -> bool {- marker() || legacy_run_value_exists()+ marker() || run_value_exists()}-/// Moves an autostart registered by an older Muelle (the `Run` key) to the-/// logon task. Updates keep the user's choice and never re-register it, so-/// the dock does it once on its own.+/// Moves the logon task of Muelle 0.1.7 and 0.1.8 back to the `Run` key:+/// autostart is on (the marker) but there is no `Run` value. Updates keep+/// the user's choice and never re-register it, so the dock does it once.pub fn migrate_legacy() {- if !legacy_run_value_exists() {+ if !marker() || run_value_exists() {return;}let Ok(exe) = env::current_exe() else {return;};- let _ = set(Some(&exe.to_string_lossy()));-}--/// The task name: one per user, since task names are shared by the whole PC.-fn task_name() -> String {- format!("Muelle ({})", env::var("USERNAME").unwrap_or_default())-}--fn schtasks(args: &[&str]) -> bool {- let system =- env::var_os("SystemRoot").map_or_else(|| PathBuf::from(r"C:\Windows"), PathBuf::from);- Command::new(system.join(r"System32\schtasks.exe"))- .args(args)- .creation_flags(CREATE_NO_WINDOW)- .output()- .is_ok_and(|output| output.status.success())+ if set_run_value(&exe.to_string_lossy()).is_ok() {+ delete_legacy_task();+ }}-fn create_task(exe: &str) -> bool {- let user = match (env::var("USERDOMAIN"), env::var("USERNAME")) {- (Ok(domain), Ok(name)) => format!("{domain}\\{name}"),- (_, Ok(name)) => name,- _ => return false,+/// Removes the logon task older versions created, through the Task+/// Scheduler's own API. Fails harmlessly if there is none.+fn delete_legacy_task() {+ use windows::{+ Win32::System::{+ Com::{+ CLSCTX_INPROC_SERVER, COINIT_MULTITHREADED, CoCreateInstance, CoInitializeEx,+ CoUninitialize,+ },+ TaskScheduler::{ITaskService, TaskScheduler},+ Variant::VARIANT,+ },+ core::BSTR,};- let path = env::temp_dir().join(format!("muelle-autostart-{}.xml", std::process::id()));- // schtasks wants the definition as UTF-16 with a byte order mark.- let bytes: Vec<u8> = std::iter::once(0xFEFF_u16)- .chain(task_xml(&user, exe).encode_utf16())- .flat_map(u16::to_le_bytes)- .collect();- if fs::write(&path, bytes).is_err() {- return false;+ // One task per user, since task names are shared by the whole PC.+ let name = format!("Muelle ({})", env::var("USERNAME").unwrap_or_default());+ // SAFETY: COM is initialized for this call and released after; the+ // service and folder are released before.+ unsafe {+ let initialized = CoInitializeEx(None, COINIT_MULTITHREADED).is_ok();+ let deleted = (|| -> windows::core::Result<()> {+ let service: ITaskService =+ CoCreateInstance(&TaskScheduler, None, CLSCTX_INPROC_SERVER)?;+ let none = VARIANT::default();+ service.Connect(&none, &none, &none, &none)?;+ service+ .GetFolder(&BSTR::from("\\"))?+ .DeleteTask(&BSTR::from(name), 0)+ })();+ let _ = deleted;+ if initialized {+ CoUninitialize();+ }}- let created = schtasks(&[- "/Create",- "/TN",- &task_name(),- "/XML",- &path.to_string_lossy(),- "/F",- ]);- let _ = fs::remove_file(&path);- created-}--fn delete_task() {- // Deleting a task that does not exist fails harmlessly.- schtasks(&["/Delete", "/TN", &task_name(), "/F"]);-}--/// The task: at this user's sign-in, run `exe` as them, without admin rights,-/// at normal priority (tasks default to below normal), on battery too, with-/// no time limit.-fn task_xml(user: &str, exe: &str) -> String {- let user = escape(user);- let exe = escape(exe);- format!(- r#"<?xml version="1.0" encoding="UTF-16"?>-<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">- <RegistrationInfo>- <Description>Starts the Muelle dock when you sign in. Turn it off in Muelle Settings.</Description>- </RegistrationInfo>- <Triggers>- <LogonTrigger>- <Enabled>true</Enabled>- <UserId>{user}</UserId>- </LogonTrigger>- </Triggers>- <Principals>- <Principal id="Author">- <UserId>{user}</UserId>- <LogonType>InteractiveToken</LogonType>- <RunLevel>LeastPrivilege</RunLevel>- </Principal>- </Principals>- <Settings>- <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>- <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>- <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>- <ExecutionTimeLimit>PT0S</ExecutionTimeLimit>- <Priority>4</Priority>- </Settings>- <Actions Context="Author">- <Exec>- <Command>{exe}</Command>- </Exec>- </Actions>-</Task>-"#- )-}--fn escape(text: &str) -> String {- text.replace('&', "&")- .replace('<', "<")- .replace('>', ">")- .replace('"', """)}fn marker() -> bool {@@ -210,13 +141,13 @@ fn set_marker(on: bool) -> windows::core::Result<()> {}}-fn legacy_run_value_exists() -> bool {+fn run_value_exists() -> bool {// SAFETY: Only asks whether the value exists; no buffers are passed.unsafe {RegGetValueW(HKEY_CURRENT_USER,RUN_KEY,- LEGACY_RUN_VALUE,+ RUN_VALUE,RRF_RT_REG_SZ,None,None,@@ -226,26 +157,24 @@ fn legacy_run_value_exists() -> bool {}}-fn set_legacy_run_value(exe: &str) -> windows::core::Result<()> {+fn set_run_value(exe: &str) -> windows::core::Result<()> {with_run_key(|key| {let command: Vec<u16> = format!("\"{exe}\"").encode_utf16().chain(Some(0)).collect();// SAFETY: `command` lives through the call.unsafe {let bytes = std::slice::from_raw_parts(command.as_ptr().cast(), command.len() * 2);- RegSetValueExW(key, LEGACY_RUN_VALUE, None, REG_SZ, Some(bytes))+ RegSetValueExW(key, RUN_VALUE, None, REG_SZ, Some(bytes))}})}-fn delete_legacy_run_value() -> windows::core::Result<()> {+fn delete_run_value() -> windows::core::Result<()> {// SAFETY: Deletes a value of the open key.- with_run_key(- |key| match unsafe { RegDeleteValueW(key, LEGACY_RUN_VALUE) } {- // Removing a value that does not exist is not an error.- WIN32_ERROR(2) => WIN32_ERROR(0),- other => other,- },- )+ with_run_key(|key| match unsafe { RegDeleteValueW(key, RUN_VALUE) } {+ // Removing a value that does not exist is not an error.+ WIN32_ERROR(2) => WIN32_ERROR(0),+ other => other,+ })}fn with_run_key(action: impl FnOnce(HKEY) -> WIN32_ERROR) -> windows::core::Result<()> {@@ -258,16 +187,3 @@ fn with_run_key(action: impl FnOnce(HKEY) -> WIN32_ERROR) -> windows::core::Resuresult.ok()}}--#[cfg(test)]-mod tests {- use super::*;-- #[test]- fn task_xml_should_escape_the_path_and_keep_the_user() {- let xml = task_xml(r"PC\ana", r"C:\Apps & Tools\muelle.exe");- assert!(xml.contains(r"<Command>C:\Apps & Tools\muelle.exe</Command>"));- assert!(xml.contains(r"<UserId>PC\ana</UserId>"));- assert!(xml.contains("<Priority>4</Priority>"));- }-}diff --git a/muelle/src/assets/usage/cursor.svg b/muelle/src/assets/usage/cursor.svgdeleted file mode 100644index a7c96a5..0000000--- a/muelle/src/assets/usage/cursor.svg+++ /dev/null@@ -1,3 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 24 24">- <path fill="#f5f7fa" d="m20.42 6.73l-8-4.62a.82.82 0 0 0-.83 0L3.58 6.73c-.22.12-.35.36-.35.61v9.32c0 .25.13.48.35.61l8.01 4.62c.26.15.57.15.83 0l8.01-4.62c.22-.12.35-.36.35-.61V7.34c0-.25-.13-.48-.35-.61Zm-.5.98L12.19 21.1c-.05.09-.19.05-.19-.05v-8.77c0-.18-.09-.34-.25-.43L4.16 7.47c-.09-.05-.05-.19.05-.19h15.46c.22 0 .36.24.25.43"/>-</svg>diff --git a/muelle/src/data/usage.ts b/muelle/src/data/usage.tsindex db1aacf..2ad8cc0 100644--- a/muelle/src/data/usage.ts+++ b/muelle/src/data/usage.ts@@ -1,7 +1,6 @@import claude from "@/assets/usage/claude.svg";import codex from "@/assets/usage/codex.svg";import copilot from "@/assets/usage/copilot.svg";-import cursor from "@/assets/usage/cursor.svg";import gemini from "@/assets/usage/gemini.svg";import opencode from "@/assets/usage/opencode.svg";@@ -42,12 +41,6 @@ export const usageProviders: UsageProvider[] = [primary: { label: "Premium", used: 32, resets: "Resets Nov 30" },secondary: { label: "Chat", used: 74, resets: "Resets Nov 30" },},- {- name: "Cursor",- logo: cursor,- color: "#aeb4bd",- primary: { label: "Billing cycle", used: 57, resets: "Resets Nov 30" },- },{name: "OpenCode Go",logo: opencode,@@ -67,13 +60,13 @@ export const usageProviders: UsageProvider[] = [export const usageIntro = {eyebrow: "AI usage",title: "AI plan usage, at a glance.",- lead: "Muelle shows available limits for Claude Code, Codex, GitHub Copilot, Cursor, OpenCode Go, and Gemini CLI or Antigravity. Gemini Pro and Flash quotas appear separately when available.",+ lead: "Muelle shows available limits for Claude Code, Codex, GitHub Copilot, OpenCode Go, and Gemini CLI or Antigravity. Gemini Pro and Flash quotas appear separately when available.",} as const;export const usageFacts = [{title: "Only while you use them",- body: "The island recognizes six clients: Claude Code, Codex, GitHub Copilot, Cursor, OpenCode Go, and Gemini CLI or Antigravity.",+ body: "The island recognizes five clients: Claude Code, Codex, GitHub Copilot, OpenCode Go, and Gemini CLI or Antigravity.",},{title: "Your existing session",diff --git a/muelle/src/pages/privacy.astro b/muelle/src/pages/privacy.astroindex ae76ef8..44226ca 100644--- a/muelle/src/pages/privacy.astro+++ b/muelle/src/pages/privacy.astro@@ -28,20 +28,21 @@ import { site } from "@/data/site";<h2>2. AI provider usage</h2><p>- The menu bar can show available plan limits for Claude Code, Codex, GitHub Copilot, Cursor,+ The menu bar can show available plan limits for Claude Code, Codex, GitHub Copilot,OpenCode Go, Gemini CLI, or Antigravity. It checks usage only while a supported client isrunning. Gemini Pro and Flash quotas are shown as separate model families when the providersupplies them.</p><ul><li>- It reads the sign-in that each client already stores on your computer: Claude Code, Codex,- VS Code or Copilot CLI, Cursor, OpenCode, Gemini CLI, or Antigravity. VS Code's GitHub session is decrypted- locally with Windows DPAPI. Muelle does not save or change these credentials.+ It reads the sign-in that each command-line client already stores on your computer: Claude Code,+ Codex, OpenCode, Gemini CLI or Antigravity, and for GitHub Copilot the sign-in of the Copilot CLI or+ the <code>GH_TOKEN</code> / <code>GITHUB_TOKEN</code> variables. Muelle never decrypts other+ apps' stored secrets or reads their databases, and does not save or change these credentials.</li><li>With that sign-in it asks the corresponding provider for available limits every five minutes while the indicator is visible, or when you press Refresh:- Anthropic, OpenAI, GitHub, Cursor, OpenCode, or Google. The sign-in only goes to its own provider.+ Anthropic, OpenAI, GitHub, OpenCode, or Google. The sign-in only goes to its own provider.Antigravity usage is read from its authenticated local service on <code>127.0.0.1</code>.Percentages and reset times stay in memory and are shown in the menu bar.</li>diff --git a/spikes/src/bin/spike_taskdelete.rs b/spikes/src/bin/spike_taskdelete.rsnew file mode 100644index 0000000..ada12e1--- /dev/null+++ b/spikes/src/bin/spike_taskdelete.rs@@ -0,0 +1,30 @@+//! Checks that a scheduled task can be deleted through the Task Scheduler API+//! (what `autostart::delete_legacy_task` does), with a throwaway task.+//! Usage: `spike_taskdelete <name>`; prints whether it existed and is gone.++use windows::{+ Win32::System::{+ Com::{CLSCTX_INPROC_SERVER, COINIT_MULTITHREADED, CoCreateInstance, CoInitializeEx},+ TaskScheduler::{ITaskService, TaskScheduler},+ Variant::VARIANT,+ },+ core::{BSTR, Result},+};++fn main() -> Result<()> {+ let name = std::env::args()+ .nth(1)+ .unwrap_or_else(|| "MuelleTest-borrar".into());+ unsafe {+ let _ = CoInitializeEx(None, COINIT_MULTITHREADED);+ let service: ITaskService = CoCreateInstance(&TaskScheduler, None, CLSCTX_INPROC_SERVER)?;+ let none = VARIANT::default();+ service.Connect(&none, &none, &none, &none)?;+ let folder = service.GetFolder(&BSTR::from("\\"))?;+ let existed = folder.GetTask(&BSTR::from(name.as_str())).is_ok();+ let deleted = folder.DeleteTask(&BSTR::from(name.as_str()), 0);+ let still = folder.GetTask(&BSTR::from(name.as_str())).is_ok();+ println!("existed={existed} delete={deleted:?} still_there={still}");+ }+ Ok(())+}