A lightweight, macOS-style dock for Windows 11, with glass visuals, smooth magnification, and Genie effect.
bump version to 0.1.2 and update README for clarity; enhance flight animation logic and introduce update handling in settings
CristianOlivera1aa5d59fad142
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex cec0c42..789cc09 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,6 +6,29 @@ copies the section of the version being published into the GitHub release.Cada versión lista sus cambios en inglés y en español. El flujo de publicacióncopia la sección de la versión que se publica a la release de GitHub.+## [0.1.2]++### English++- Updates are announced in Settings: a banner above every section with+ "Update now", "Later" and "What's new", download progress, and a badge on+ System while an update waits.+- Smoother Genie effect: the system compositor now runs the whole animation+ at the display's refresh rate, and it no longer skips its first frames.+- Fixed: the Dock section of Settings could not scroll to its last options.+- Fixed: opening Settings twice opened two windows; it now brings the open one+ to the front.++### Español++- Las actualizaciones se anuncian en Ajustes: un aviso encima de cada sección+ con «Actualizar ahora», «Más tarde» y «Novedades», progreso de la descarga y+ una insignia en Sistema mientras haya una pendiente.+- Efecto genio más fluido: el compositor del sistema ejecuta toda la animación+ a la frecuencia del monitor y ya no se salta sus primeros fotogramas.+- Corregido: la sección Dock de Ajustes no dejaba bajar hasta las últimas opciones.+- Corregido: abrir Ajustes dos veces abría dos ventanas; ahora trae al frente la abierta.+## [0.1.1]### Englishdiff --git a/Cargo.lock b/Cargo.lockindex b79b3f4..a849454 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -47,6 +47,137 @@ version = "1.0.104"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470"+[[package]]+name = "async-broadcast"+version = "0.7.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532"+dependencies = [+ "event-listener",+ "event-listener-strategy",+ "futures-core",+ "pin-project-lite",+]++[[package]]+name = "async-channel"+version = "2.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2"+dependencies = [+ "concurrent-queue",+ "event-listener-strategy",+ "futures-core",+ "pin-project-lite",+]++[[package]]+name = "async-executor"+version = "1.14.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f426a31126c735126297bc5ea7a521263c9faff4f63ca415267ee625651c4f37"+dependencies = [+ "async-task",+ "concurrent-queue",+ "fastrand",+ "futures-lite",+ "pin-project-lite",+ "slab",+]++[[package]]+name = "async-io"+version = "2.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc"+dependencies = [+ "autocfg",+ "cfg-if",+ "concurrent-queue",+ "futures-io",+ "futures-lite",+ "parking",+ "polling",+ "rustix",+ "slab",+ "windows-sys 0.61.2",+]++[[package]]+name = "async-lock"+version = "3.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0876700b0d007ad25d5508865a4259c3af9af6d296bf663a0d586d0bc3369f6f"+dependencies = [+ "event-listener",+ "event-listener-strategy",+ "pin-project-lite",+]++[[package]]+name = "async-process"+version = "2.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75"+dependencies = [+ "async-channel",+ "async-io",+ "async-lock",+ "async-signal",+ "async-task",+ "blocking",+ "cfg-if",+ "event-listener",+ "futures-lite",+ "rustix",+]++[[package]]+name = "async-recursion"+version = "1.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4f8abc12baad266b1c8cec146854c195b5864b4221d4b2ca7296a7ae82d9e451"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.10",+]++[[package]]+name = "async-signal"+version = "0.2.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485"+dependencies = [+ "async-io",+ "async-lock",+ "atomic-waker",+ "cfg-if",+ "futures-core",+ "futures-io",+ "rustix",+ "signal-hook-registry",+ "slab",+ "windows-sys 0.61.2",+]++[[package]]+name = "async-task"+version = "4.7.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de"++[[package]]+name = "async-trait"+version = "0.1.92"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.10",+]+[[package]]name = "atk"version = "0.18.2"@@ -157,6 +288,19 @@ dependencies = ["objc2",]+[[package]]+name = "blocking"+version = "1.7.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa"+dependencies = [+ "async-channel",+ "async-task",+ "futures-io",+ "futures-lite",+ "piper",+]+[[package]]name = "brotli"version = "9.1.1"@@ -353,6 +497,15 @@ dependencies = ["memchr",]+[[package]]+name = "concurrent-queue"+version = "2.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"+dependencies = [+ "crossbeam-utils",+]+[[package]]name = "constant_time_eq"version = "0.6.1"@@ -745,6 +898,33 @@ version = "1.2.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7"+[[package]]+name = "endi"+version = "1.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099"++[[package]]+name = "enumflags2"+version = "0.7.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef"+dependencies = [+ "enumflags2_derive",+ "serde",+]++[[package]]+name = "enumflags2_derive"+version = "0.7.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]+[[package]]name = "equivalent"version = "1.0.3"@@ -772,6 +952,26 @@ dependencies = ["windows-sys 0.61.2",]+[[package]]+name = "event-listener"+version = "5.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2"+dependencies = [+ "parking",+ "pin-project-lite",+]++[[package]]+name = "event-listener-strategy"+version = "0.5.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93"+dependencies = [+ "event-listener",+ "pin-project-lite",+]+[[package]]name = "fastrand"version = "2.5.0"@@ -904,6 +1104,19 @@ version = "0.3.34"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed"+[[package]]+name = "futures-lite"+version = "2.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad"+dependencies = [+ "fastrand",+ "futures-core",+ "futures-io",+ "parking",+ "pin-project-lite",+]+[[package]]name = "futures-macro"version = "0.3.34"@@ -1260,6 +1473,12 @@ version = "0.5.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"+[[package]]+name = "hermit-abi"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284"+[[package]]name = "hex"version = "0.4.3"@@ -1954,7 +2173,7 @@ dependencies = [[[package]]name = "muelle"-version = "0.1.1"+version = "0.1.2"dependencies = ["anyhow","muelle-config",@@ -1968,7 +2187,7 @@ dependencies = [[[package]]name = "muelle-config"-version = "0.1.1"+version = "0.1.2"dependencies = ["serde","serde_json",@@ -1977,11 +2196,11 @@ dependencies = [[[package]]name = "muelle-core"-version = "0.1.1"+version = "0.1.2"[[package]]name = "muelle-settings"-version = "0.1.1"+version = "0.1.2"dependencies = ["muelle-config","muelle-shell",@@ -1989,12 +2208,13 @@ dependencies = ["serde_json","tauri","tauri-build",+ "tauri-plugin-single-instance","tauri-plugin-updater",][[package]]name = "muelle-shell"-version = "0.1.1"+version = "0.1.2"dependencies = ["thiserror 2.0.21","windows",@@ -2313,6 +2533,16 @@ version = "0.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"+[[package]]+name = "ordered-stream"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50"+dependencies = [+ "futures-core",+ "pin-project-lite",+]+[[package]]name = "osakit"version = "0.3.1"@@ -2352,6 +2582,12 @@ dependencies = ["system-deps",]+[[package]]+name = "parking"+version = "2.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"+[[package]]name = "parking_lot"version = "0.12.5"@@ -2493,6 +2729,17 @@ version = "0.2.17"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"+[[package]]+name = "piper"+version = "0.2.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1"+dependencies = [+ "atomic-waker",+ "fastrand",+ "futures-io",+]+[[package]]name = "pkg-config"version = "0.3.34"@@ -2525,6 +2772,20 @@ dependencies = ["miniz_oxide 0.8.9",]+[[package]]+name = "polling"+version = "3.11.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218"+dependencies = [+ "cfg-if",+ "concurrent-queue",+ "hermit-abi",+ "pin-project-lite",+ "rustix",+ "windows-sys 0.61.2",+]+[[package]]name = "portable-atomic"version = "1.15.0"@@ -3216,6 +3477,16 @@ version = "2.0.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"+[[package]]+name = "signal-hook-registry"+version = "1.4.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b"+dependencies = [+ "errno",+ "libc",+]+[[package]]name = "simd-adler32"version = "0.3.10"@@ -3691,6 +3962,22 @@ dependencies = ["walkdir",]+[[package]]+name = "tauri-plugin-single-instance"+version = "2.5.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "726b6da0dd5bd1344f84f4108a622c07d01923baacb5c803a605189672c5352f"+dependencies = [+ "serde",+ "serde_json",+ "tauri",+ "thiserror 2.0.21",+ "tokio",+ "tracing",+ "windows-sys 0.61.2",+ "zbus",+]+[[package]]name = "tauri-plugin-updater"version = "2.14.1"@@ -4117,9 +4404,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"dependencies = ["pin-project-lite",+ "tracing-attributes","tracing-core",]+[[package]]+name = "tracing-attributes"+version = "0.1.31"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]+[[package]]name = "tracing-core"version = "0.1.36"@@ -4175,6 +4474,17 @@ version = "1.20.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"+[[package]]+name = "uds_windows"+version = "1.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e"+dependencies = [+ "memoffset",+ "tempfile",+ "windows-sys 0.61.2",+]+[[package]]name = "unicode-ident"version = "1.0.27"@@ -4982,6 +5292,76 @@ dependencies = ["synstructure",]+[[package]]+name = "zbus"+version = "5.19.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907"+dependencies = [+ "async-broadcast",+ "async-executor",+ "async-io",+ "async-lock",+ "async-process",+ "async-recursion",+ "async-task",+ "async-trait",+ "blocking",+ "enumflags2",+ "event-listener",+ "futures-core",+ "futures-lite",+ "hex",+ "libc",+ "ordered-stream",+ "rustix",+ "serde",+ "serde_repr",+ "tracing",+ "uds_windows",+ "uuid",+ "windows-sys 0.61.2",+ "winnow 1.0.5",+ "zbus_macros",+ "zbus_names",+ "zvariant",+]++[[package]]+name = "zbus_macros"+version = "5.19.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40"+dependencies = [+ "proc-macro-crate 3.5.0",+ "proc-macro2",+ "quote",+ "syn 3.0.10",+ "zbus_names",+ "zvariant",+ "zvariant_utils",+]++[[package]]+name = "zbus_names"+version = "4.3.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "812a12be4ead7a59e18ea8f047d08add0066b73bc62fc1467066a2472ae088dd"+dependencies = [+ "serde",+ "winnow 1.0.5",+ "zvariant",+]++[[package]]+name = "zcheapstr"+version = "1.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "939f186d9ecebe044315a5cb6d6f78568bbc21152adc954d5a0c2f58bdbc9920"+dependencies = [+ "serde",+]+[[package]]name = "zerofrom"version = "0.1.8"@@ -5085,3 +5465,44 @@ name = "zmij"version = "1.0.23"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"++[[package]]+name = "zvariant"+version = "5.15.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "80bf6d6cd6a4b601acb64cfb8284cdc643fcfa75ef26ae3c46ec8aa4e8a1fbb7"+dependencies = [+ "endi",+ "enumflags2",+ "serde",+ "winnow 1.0.5",+ "zcheapstr",+ "zvariant_derive",+ "zvariant_utils",+]++[[package]]+name = "zvariant_derive"+version = "5.15.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ef2672456ba1cb54b5eaec136e63135b3c7495fb938e53b28a62e633496d486d"+dependencies = [+ "proc-macro-crate 3.5.0",+ "proc-macro2",+ "quote",+ "syn 3.0.10",+ "zvariant_utils",+]++[[package]]+name = "zvariant_utils"+version = "4.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3"+dependencies = [+ "proc-macro2",+ "quote",+ "serde",+ "syn 3.0.10",+ "winnow 1.0.5",+]diff --git a/Cargo.toml b/Cargo.tomlindex 21c36b9..373a63d 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -3,7 +3,7 @@ resolver = "3"members = ["crates/*", "apps/dock", "apps/settings/src-tauri", "spikes"][workspace.package]-version = "0.1.1"+version = "0.1.2"edition = "2024"license = "MIT"diff --git a/README.md b/README.mdindex c6c649f..e3ab1c0 100644--- a/README.md+++ b/README.md@@ -4,7 +4,8 @@**A lightweight, macOS-inspired dock for Windows 11.**- Smooth magnification, live window previews, and an optional Genie-style minimize effect.+ Muelle replaces the Windows taskbar with a customizable dock and an optional+ macOS-style menu bar.</div>@@ -12,9 +13,7 @@<img width="1000" height="243" alt="ezgif-2421a892c23dc19b" src="https://github.com/user-attachments/assets/83d43043-c6a2-469f-bb87-053e5be868f1" />-Muelle replaces the Windows taskbar with a customizable dock and an optional-macOS-style menu bar. It is built for Windows 11 and is still under active-development.+Smooth magnification, live window previews, and an optional Genie-style minimize effect.| Auto-hiding Dock and Menu Bar | Genie Effect on Minimize ||---|---|diff --git a/apps/dock/src/flight.rs b/apps/dock/src/flight.rsindex ebd2073..fd497ea 100644--- a/apps/dock/src/flight.rs+++ b/apps/dock/src/flight.rs@@ -10,8 +10,15 @@//! 2. a frame later that rectangle is copied from the screen: a snapshot, as//! macOS also uses for its genie;//! 3. the snapshot becomes one composition surface shared by thin horizontal-//! strips (plain composition visuals), placed every frame along the genie-//! curves (`muelle_core::genie`).+//! strips (plain composition visuals) that follow the genie curves+//! (`muelle_core::genie`).+//!+//! The dock does not move the strips itself. Each strip gets two expression+//! animations (offset and scale) that read two shared values, `bend` and+//! `shift`, and those two are keyframe animations: the system compositor runs+//! the whole flight on its own thread at the display's refresh rate. Placing+//! ~300 strips from the UI thread every frame was measured at 8-10 ms a frame+//! and made the compositor skip every other refresh.//!//! To restore, the same strips play backwards from a quarter-size copy of that//! snapshot (a [`Snapshot`], kept while the window is minimized), and the real@@ -32,11 +39,12 @@ use std::{};use anyhow::Result;-use muelle_core::genie::{Edges, Genie, Strip};+use muelle_core::genie::{Edges, Genie};use muelle_shell::{icons::IconImage, screen};use windows::{+ Foundation::TimeSpan,UI::Composition::{- CompositionStretch, CompositionSurfaceBrush, ContainerVisual, Desktop::DesktopWindowTarget,+ CompositionPropertySet, CompositionStretch, ContainerVisual, Desktop::DesktopWindowTarget,SpriteVisual,},Win32::{@@ -53,9 +61,9 @@ use windows::{WS_EX_TOOLWINDOW, WS_EX_TOPMOST, WS_EX_TRANSPARENT, WS_POPUP,},},- core::{Interface, w},+ core::{HSTRING, Interface, h, w},};-use windows_numerics::{Matrix3x2, Vector2, Vector3};+use windows_numerics::{Matrix3x2, Vector2};use crate::gfx::Gfx;@@ -63,6 +71,13 @@ const DURATION_SECONDS: f32 = 0.5;/// Screen rows per strip: the edge of the funnel steps by at most a few pixels.const STRIP_ROWS: u32 = 3;const MAX_STRIPS: u32 = 400;+/// Samples of the bend and slide curves handed to the compositor, which+/// interpolates between them at the display's refresh rate.+const KEYFRAMES: u32 = 30;+/// Extra source rows each strip draws below itself. Strips sit at fractional+/// positions while they fly; overlapping the next one (same pixels) leaves no+/// seam between their antialiased edges.+const OVERLAP_ROWS: f32 = 1.0;/// Frames the thumbnail stays up before the screen is copied, so DWM has/// certainly presented it.const FRAMES_BEFORE_SNAPSHOT: u32 = 2;@@ -91,28 +106,21 @@ impl Snapshot {struct Piece {visual: SpriteVisual,- brush: CompositionSurfaceBrush,/// First source row and row count, in snapshot pixels.top: f32,rows: f32,- /// Last placement applied (`None` = hidden), to skip redundant calls.- shown: Option<[i32; 4]>,}enum Phase {/// The stand-in thumbnail is on screen; counting frames until the snapshot.- Standing {- thumbnail: isize,- frames: u32,- },+ Standing { thumbnail: isize, frames: u32 },Flying {start: Instant,- pieces: Vec<Piece>,+ /// Kept alive: the strips' animations read it.+ _drive: CompositionPropertySet,},/// A restore has reached full size and waits for the real window.- Settling {- until: Instant,- },+ Settling { until: Instant },}pub struct Flight {@@ -126,15 +134,13 @@ pub struct Flight {origin: (i32, i32),genie: Genie,phase: Phase,- /// Scratch buffer reused every frame.- strips: Vec<Strip>,- /// Width of the surface the strips sample, in its own pixels.- source_width: f32,/// Out of the dock instead of into it.restoring: bool,/// The real window still has to be restored (restore flights only).restore_pending: bool,- snapshot: Option<Snapshot>,+ /// The full-size screen copy of a minimize, reduced only once the flight+ /// is over so that work stays out of the take-off.+ captured: Option<(IconImage, RECT)>,}unsafe extern "system" fn overlay_proc(hwnd: HWND, msg: u32, w: WPARAM, l: LPARAM) -> LRESULT {@@ -261,34 +267,120 @@ fn cut(let children = root.Children()?;(0..count).map(|index| {+ let (top, rows) = (row(index), row(index + 1) - row(index));let brush = compositor.CreateSurfaceBrushWithSurface(&surface)?;brush.SetStretch(CompositionStretch::None)?;brush.SetHorizontalAlignmentRatio(0.0)?;brush.SetVerticalAlignmentRatio(0.0)?;+ // Bring this strip's first row to the top of the visual.+ brush.SetTransformMatrix(Matrix3x2::translation(0.0, -top))?;+ // The visual has the strip's natural size; its animated scale+ // squeezes it into place.let visual = compositor.CreateSpriteVisual()?;+ visual.SetSize(Vector2 {+ X: image.width as f32,+ Y: rows + OVERLAP_ROWS,+ })?;visual.SetBrush(&brush)?;- visual.SetIsVisible(false)?;children.InsertAtTop(&visual)?;- Ok(Piece {- visual,- brush,- top: row(index),- rows: row(index + 1) - row(index),- shown: None,- })+ Ok(Piece { visual, top, rows })}).collect()}-fn blank_strips(count: usize) -> Vec<Strip> {- vec![- Strip {- source_top: 0.0,- source_bottom: 0.0,- target: None,- };- count- ]+/// Hands the flight to the compositor: every strip follows `genie` for+/// `DURATION_SECONDS`, into the slot or (`reverse`) out of it.+///+/// The expressions are `Genie::frame` written for the compositor: a strip's+/// top is its resting row plus `shift`, its bottom stops at the slot, and its+/// sides follow the cosine funnel scaled by `bend`.+fn fly(+ gfx: &Gfx,+ genie: &Genie,+ pieces: &[Piece],+ image: (f32, f32),+ reverse: bool,+) -> Result<CompositionPropertySet> {+ let compositor = &gfx.compositor;+ let (window, slot) = (genie.window, genie.slot);+ let travel = (slot.bottom - window.top).max(0.0);+ let at = |progress: f32| if reverse { 1.0 - progress } else { progress };++ let drive = compositor.CreatePropertySet()?;+ drive.InsertScalar(h!("bend"), Genie::bend(at(0.0)))?;+ drive.InsertScalar(h!("shift"), Genie::slide(at(0.0)) * travel)?;++ // How far along the funnel the middle of the strip is, eased by a cosine.+ let curve = format!(+ "((1 - Cos(3.14159265 * Clamp(((y0 + Min(y1, {bottom:.3} - d.shift)) * 0.5 + d.shift - ({top:.3})) / {span:.3}, 0, 1))) * 0.5 * d.bend)",+ bottom = slot.bottom,+ top = window.top,+ span = (slot.top - window.top).max(1.0),+ );+ let offset = format!(+ "Vector3(({left:.3}) + ({shrink:.3}) * {curve}, y0 + d.shift, 0)",+ left = window.left,+ shrink = slot.left - window.left,+ );+ let scale = format!(+ "Vector3((({width:.3}) + ({narrow:.3}) * {curve}) / {source:.3}, Max(Min(y1, {bottom:.3} - d.shift) - y0, 0) / rows, 1)",+ width = window.right - window.left,+ narrow = (slot.right - slot.left) - (window.right - window.left),+ source = image.0,+ bottom = slot.bottom,+ );+ let offset = compositor.CreateExpressionAnimationWithExpression(&HSTRING::from(offset))?;+ let scale = compositor.CreateExpressionAnimationWithExpression(&HSTRING::from(scale))?;+ offset.SetReferenceParameter(h!("d"), &drive)?;+ scale.SetReferenceParameter(h!("d"), &drive)?;++ // Screen rows per source row.+ let stretch = (window.bottom - window.top) / image.1;+ for piece in pieces {+ let y0 = window.top + piece.top * stretch;+ let y1 = y0 + piece.rows * stretch;+ // Each start takes a copy of the animation with these values.+ offset.SetScalarParameter(h!("y0"), y0)?;+ offset.SetScalarParameter(h!("y1"), y1)?;+ scale.SetScalarParameter(h!("y0"), y0)?;+ scale.SetScalarParameter(h!("y1"), y1)?;+ scale.SetScalarParameter(h!("rows"), piece.rows)?;+ piece.visual.StartAnimation(h!("Offset"), &offset)?;+ piece.visual.StartAnimation(h!("Scale"), &scale)?;+ }++ // Last, so every strip is already listening when the values start moving.+ let linear = compositor.CreateLinearEasingFunction()?;+ let duration = TimeSpan {+ Duration: (DURATION_SECONDS * 1e7) as i64,+ };+ let animate = |name: &HSTRING, curve: fn(f32) -> f32, amount: f32| -> Result<()> {+ let animation = compositor.CreateScalarKeyFrameAnimation()?;+ animation.SetDuration(duration)?;+ for step in 0..=KEYFRAMES {+ let progress = step as f32 / KEYFRAMES as f32;+ animation.InsertKeyFrameWithEasingFunction(+ progress,+ curve(at(progress)) * amount,+ &linear,+ )?;+ }+ drive.StartAnimation(name, &animation)?;+ Ok(())+ };+ animate(h!("bend"), Genie::bend, 1.0)?;+ animate(h!("shift"), Genie::slide, travel)?;+ Ok(drive)+}++/// Nothing is drawn below the slot: strips vanish as they enter it.+fn clip_at_slot(gfx: &Gfx, root: &ContainerVisual, genie: &Genie, screen: RECT) -> Result<()> {+ let below = (screen.bottom - screen.top) as f32 - genie.slot.bottom;+ let clip = gfx+ .compositor+ .CreateInsetClipWithInsets(0.0, 0.0, 0.0, below.max(0.0))?;+ root.SetClip(&clip)?;+ Ok(())}fn local(rect: RECT, screen: RECT) -> Edges {@@ -338,25 +430,27 @@ impl Flight {let _ = ShowWindow(overlay, SW_SHOWNOACTIVATE);thumbnail};+ let genie = Genie {+ window: local(visible, screen),+ slot: local(to, screen),+ };+ // Without the clip the flight still works; strips would only show a+ // little below the slot.+ let _ = clip_at_slot(gfx, &root, &genie, screen);Some(Self {hwnd,overlay,_target: target,root,origin: (screen.left, screen.top),- genie: Genie {- window: local(visible, screen),- slot: local(to, screen),- },+ genie,phase: Phase::Standing {thumbnail,frames: 0,},- strips: Vec::new(),- source_width: (visible.right - visible.left) as f32,restoring: false,restore_pending: false,- snapshot: None,+ captured: None,})}@@ -376,34 +470,37 @@ impl Flight {}let (overlay, target, root) = create_overlay(gfx, screen)?;let height = (window.bottom - window.top) as u32;- let Ok(pieces) = cut(gfx, &root, &snapshot.image, height) else {+ let genie = Genie {+ window: local(window, screen),+ slot: local(slot, screen),+ };+ let image = &snapshot.image;+ let size = (image.width as f32, image.height as f32);+ let drive = clip_at_slot(gfx, &root, &genie, screen)+ .and_then(|()| cut(gfx, &root, image, height))+ .and_then(|pieces| fly(gfx, &genie, &pieces, size, true));+ let Ok(drive) = drive else {// SAFETY: Our own window, destroyed once.unsafe {let _ = DestroyWindow(overlay);}return None;};- let mut flight = Self {+ let flight = Self {hwnd,overlay,_target: target,root,origin: (screen.left, screen.top),- genie: Genie {- window: local(window, screen),- slot: local(slot, screen),- },- strips: blank_strips(pieces.len()),+ genie,phase: Phase::Flying {start: Instant::now(),- pieces,+ _drive: drive,},- source_width: snapshot.image.width as f32,restoring: true,restore_pending: true,- snapshot: None,+ captured: None,};- let _ = flight.place(1.0);// SAFETY: Our own live window.unsafe {let _ = ShowWindow(flight.overlay, SW_SHOWNOACTIVATE);@@ -420,12 +517,15 @@ impl Flight {return true;}let thumbnail = *thumbnail;- let Ok(pieces) = self.take_snapshot(gfx) else {+ let Ok(drive) = self.take_off(gfx) else {return false;};- self.strips = blank_strips(pieces.len());- self.phase = Phase::Flying { start: now, pieces };- let _ = self.place(0.0);+ // The clock starts once the strips are up: copying the screen+ // takes tens of milliseconds that must not eat the animation.+ self.phase = Phase::Flying {+ start: Instant::now(),+ _drive: drive,+ };// The strips now show the same image: the stand-in can go.// SAFETY: `thumbnail` came from DwmRegisterThumbnail and is released once.unsafe {@@ -433,19 +533,19 @@ impl Flight {}true}+ // The compositor is flying the strips; only the end is ours.Phase::Flying { start, .. } => {- let t = now.duration_since(*start).as_secs_f32() / DURATION_SECONDS;- if !self.restoring {- return t < 1.0 && self.place(t).is_ok();- }+ let t = now.saturating_duration_since(*start).as_secs_f32() / DURATION_SECONDS;if t < 1.0 {- return self.place(1.0 - t).is_ok();+ return true;+ }+ if !self.restoring {+ return false;}- let arrived = self.place(0.0).is_ok();self.phase = Phase::Settling {until: now + SETTLE,};- arrived+ true}Phase::Settling { until } => now < *until,}@@ -461,7 +561,10 @@ impl Flight {/// The snapshot of a window that has just been minimized, to restore it/// with the genie later.pub fn take_snapshot_for_restore(&mut self) -> Option<Snapshot> {- self.snapshot.take()+ self.captured.take().map(|(image, window)| Snapshot {+ image: halved(&image),+ window,+ })}/// Opacity (0..=255) of the dock's own thumbnail for this window: it@@ -470,7 +573,7 @@ impl Flight {let Phase::Flying { start, .. } = &self.phase else {return 0;};- let elapsed = now.duration_since(*start).as_secs_f32() / DURATION_SECONDS;+ let elapsed = now.saturating_duration_since(*start).as_secs_f32() / DURATION_SECONDS;let t = if self.restoring {1.0 - elapsed} else {@@ -479,8 +582,9 @@ impl Flight {(((t - LANDING_START) / (1.0 - LANDING_START)).clamp(0.0, 1.0) * 255.0) as u8}- /// Copies the window's rectangle from the screen and cuts it into strips.- fn take_snapshot(&mut self, gfx: &Gfx) -> Result<Vec<Piece>> {+ /// Copies the window's rectangle from the screen, cuts it into strips and+ /// starts them flying.+ fn take_off(&mut self, gfx: &Gfx) -> Result<CompositionPropertySet> {let edges = self.genie.window;let window = RECT {left: edges.left as i32 + self.origin.0,@@ -491,68 +595,10 @@ impl Flight {let image =screen::capture(window).ok_or_else(|| anyhow::anyhow!("screen capture failed"))?;let pieces = cut(gfx, &self.root, &image, image.height)?;- self.snapshot = Some(Snapshot {- image: halved(&image),- window,- });- Ok(pieces)- }-- fn place(&mut self, t: f32) -> Result<()> {- let Phase::Flying { pieces, .. } = &mut self.phase else {- return Ok(());- };- let source_width = self.source_width;- self.genie.frame(t, &mut self.strips);- for (piece, strip) in pieces.iter_mut().zip(&self.strips) {- // Whole pixels, so neighbouring strips meet without seams.- let target = strip- .target- .map(|edges| {- [- edges.left.round() as i32,- edges.top.round() as i32,- edges.right.round() as i32,- edges.bottom.round() as i32,- ]- })- .filter(|[left, top, right, bottom]| right > left && bottom > top);- if piece.shown == target {- continue;- }- let Some([left, top, right, bottom]) = target else {- piece.visual.SetIsVisible(false)?;- piece.shown = None;- continue;- };- if piece.shown.is_none() {- piece.visual.SetIsVisible(true)?;- }- piece.shown = target;-- let (width, height) = ((right - left) as f32, (bottom - top) as f32);- piece.visual.SetOffset(Vector3 {- X: left as f32,- Y: top as f32,- Z: 0.0,- })?;- piece.visual.SetSize(Vector2 {- X: width,- Y: height,- })?;- // Squeeze the full snapshot width into the strip and bring this- // strip's first row to the top of the visual.- let (scale_x, scale_y) = (width / source_width, height / piece.rows);- piece.brush.SetTransformMatrix(Matrix3x2 {- M11: scale_x,- M12: 0.0,- M21: 0.0,- M22: scale_y,- M31: 0.0,- M32: -piece.top * scale_y,- })?;- }- Ok(())+ let size = (image.width as f32, image.height as f32);+ let drive = fly(gfx, &self.genie, &pieces, size, false)?;+ self.captured = Some((image, window));+ Ok(drive)}}diff --git a/apps/settings/src-tauri/Cargo.toml b/apps/settings/src-tauri/Cargo.tomlindex 08c5c68..a37eb7f 100644--- a/apps/settings/src-tauri/Cargo.toml+++ b/apps/settings/src-tauri/Cargo.toml@@ -16,6 +16,9 @@ muelle-shell.workspace = trueserde.workspace = truetauri = { version = "2", features = [] }tauri-plugin-updater = "2"+# A second launch (dock menu, Start menu) focuses the open window instead of+# opening another one that would save the same settings file.+tauri-plugin-single-instance = "2"# `generate_context!` emits serde_json values for plugin settings.serde_json = "1"diff --git a/apps/settings/src-tauri/src/main.rs b/apps/settings/src-tauri/src/main.rsindex a2bdbe5..9dffb36 100644--- a/apps/settings/src-tauri/src/main.rs+++ b/apps/settings/src-tauri/src/main.rs@@ -6,8 +6,9 @@use std::{env, io, path::PathBuf, process::Command, sync::Mutex};use muelle_config::Config;-use muelle_shell::{autostart, dock_link};-use tauri::State;+use muelle_shell::{autostart, dock_link, launcher};+use serde::Serialize;+use tauri::{Emitter, Manager, State};use tauri_plugin_updater::{Update, UpdaterExt};/// The dock owns the pinned and recent apps; this app never overwrites them@@ -73,30 +74,75 @@ struct PendingUpdate(Mutex<Option<Update>>);async fn check_update(app: tauri::AppHandle,pending: State<'_, PendingUpdate>,-) -> Result<Option<String>, String> {+) -> Result<Option<UpdateInfo>, String> {let update = app.updater().map_err(|error| error.to_string())?.check().await.map_err(|error| error.to_string())?;- let version = update.as_ref().map(|update| update.version.clone());+ let info = update.as_ref().map(|update| UpdateInfo {+ version: update.version.clone(),+ notes: update.body.clone().filter(|notes| is_release_page(notes)),+ });*pending.0.lock().map_err(|error| error.to_string())? = update;- Ok(version)+ Ok(info)+}++/// What the window shows about an available update.+#[derive(Serialize)]+struct UpdateInfo {+ version: String,+ /// The release page, when the manifest points at one.+ notes: Option<String>,+}++/// Download progress, sent to the window as `update-progress`.+#[derive(Clone, Serialize)]+struct Progress {+ downloaded: u64,+ total: Option<u64>,+}++const RELEASES: &str = "https://github.com/crafter-station/Muelle/releases/";++/// The update manifest is not signed (only the installer is), so the only+/// link it may open is a release page of this repository.+fn is_release_page(url: &str) -> bool {+ url.starts_with(RELEASES) && !url.contains(char::is_whitespace)+}++#[tauri::command]+fn open_release_notes(url: String) -> Result<(), String> {+ if !is_release_page(&url) {+ return Err("enlace no permitido".into());+ }+ launcher::open(&url).map_err(|error| error.to_string())}/// Downloads the signed installer and runs it; the installer stops the dock,/// replaces both apps and starts the dock again. This process exits.#[tauri::command]-async fn install_update(pending: State<'_, PendingUpdate>) -> Result<(), String> {+async fn install_update(+ app: tauri::AppHandle,+ pending: State<'_, PendingUpdate>,+) -> Result<(), String> {+ // Cloned, not taken: if the download fails the user can try again.let update = pending.0.lock().map_err(|error| error.to_string())?- .take()+ .clone().ok_or("no hay ninguna actualización pendiente")?;+ let mut downloaded = 0u64;update- .download_and_install(|_, _| {}, || {})+ .download_and_install(+ |chunk, total| {+ downloaded += chunk as u64;+ let _ = app.emit("update-progress", Progress { downloaded, total });+ },+ || {},+ ).await.map_err(|error| error.to_string())}@@ -110,6 +156,14 @@ fn main() {eprintln!("muelle-settings: no se pudo abrir el dock: {error}");}let result = tauri::Builder::default()+ // First, so a second launch exits before doing anything else.+ .plugin(tauri_plugin_single_instance::init(|app, _, _| {+ if let Some(window) = app.get_webview_window("main") {+ let _ = window.unminimize();+ let _ = window.show();+ let _ = window.set_focus();+ }+ })).plugin(tauri_plugin_updater::Builder::new().build()).manage(PendingUpdate::default()).invoke_handler(tauri::generate_handler![@@ -119,7 +173,8 @@ fn main() {get_autostart,set_autostart,check_update,- install_update+ install_update,+ open_release_notes]).run(tauri::generate_context!());if let Err(error) = result {diff --git a/apps/settings/src/App.tsx b/apps/settings/src/App.tsxindex 00bb5b0..a171829 100644--- a/apps/settings/src/App.tsx+++ b/apps/settings/src/App.tsx@@ -1,10 +1,12 @@import { getVersion } from "@tauri-apps/api/app";+import { listen } from "@tauri-apps/api/event";import { getCurrentWindow } from "@tauri-apps/api/window";import { useCallback, useEffect, useRef, useState } from "react";import {type ActiveAppClick,type Config,type Language,+ type UpdateInfo,ICON_SIZE,MAX_MAGNIFIED_SIZE,checkUpdate,@@ -12,10 +14,12 @@ import {getAutostart,installUpdate,loadConfig,+ openReleaseNotes,saveConfig,setAutostart,} from "./config";import { Card, Row, Segmented, Slider, Toggle } from "./controls";+import { UpdateBanner } from "./UpdateBanner";import en from "./i18n/en.json";import es from "./i18n/es.json";@@ -23,12 +27,24 @@ type Section = "dock" | "system";type UpdateState =| { kind: "checking" }| { kind: "current" }- | { kind: "available"; version: string }- | { kind: "installing" }+ | { kind: "available"; info: UpdateInfo }+ | { kind: "installing"; info: UpdateInfo; progress: number | null }+ | { kind: "installFailed"; info: UpdateInfo }| { kind: "error" };-const toUpdateState = (found: string | null): UpdateState =>- found ? { kind: "available", version: found } : { kind: "current" };+const toUpdateState = (found: UpdateInfo | null): UpdateState =>+ found ? { kind: "available", info: found } : { kind: "current" };++/** An update is waiting for the user: the banner and the badge show. */+const pendingUpdate = (state: UpdateState): UpdateInfo | null =>+ state.kind === "available" || state.kind === "installing" || state.kind === "installFailed"+ ? state.info+ : null;++interface ProgressEvent {+ downloaded: number;+ total: number | null;+}type Texts = typeof es;/** Dragging a slider saves at most this often; the dock redraws on each save. */@@ -50,8 +66,11 @@ export function App() {const [version, setVersion] = useState("");const [updateState, setUpdateState] = useState<UpdateState>({ kind: "checking" });const [confirmingReset, setConfirmingReset] = useState(false);+ /** "Later" hides the banner until Settings is opened again. */+ const [bannerDismissed, setBannerDismissed] = useState(false);const pending = useRef<Config | null>(null);const timer = useRef<number | undefined>(undefined);+ const resetTimer = useRef<number | undefined>(undefined);useEffect(() => {let alive = true;@@ -69,9 +88,15 @@ export function App() {checkUpdate().then((found) => alive && setUpdateState(toUpdateState(found))).catch(() => alive && setUpdateState({ kind: "error" }));+ const progress = listen<ProgressEvent>("update-progress", ({ payload }) => {+ const share = payload.total ? Math.min(payload.downloaded / payload.total, 1) : null;+ setUpdateState((state) => (state.kind === "installing" ? { ...state, progress: share } : state));+ });return () => {alive = false;window.clearTimeout(timer.current);+ window.clearTimeout(resetTimer.current);+ progress.then((unlisten) => unlisten()).catch(() => {});};}, []);@@ -112,10 +137,14 @@ export function App() {.catch(() => setUpdateState({ kind: "error" }));}, []);- const install = useCallback(() => {- setUpdateState({ kind: "installing" });+ const install = useCallback((info: UpdateInfo) => {+ setUpdateState({ kind: "installing", info, progress: null });// On success the installer replaces this app and this process exits.- installUpdate().catch(() => setUpdateState({ kind: "error" }));+ installUpdate().catch(() => setUpdateState({ kind: "installFailed", info }));+ }, []);++ const showNotes = useCallback((info: UpdateInfo) => {+ if (info.notes) openReleaseNotes(info.notes).catch(() => {});}, []);// Two clicks: the first arms the button, the second resets. Pinned and@@ -123,7 +152,7 @@ export function App() {const reset = useCallback(() => {if (!confirmingReset) {setConfirmingReset(true);- window.setTimeout(() => setConfirmingReset(false), RESET_CONFIRM_MS);+ resetTimer.current = window.setTimeout(() => setConfirmingReset(false), RESET_CONFIRM_MS);return;}setConfirmingReset(false);@@ -135,6 +164,10 @@ export function App() {if (!config) return <div className="window" />;const t = textsFor(config.language);const appWindow = getCurrentWindow();+ const waiting = pendingUpdate(updateState);+ // An update the user asked for keeps its banner even after "Later".+ const showBanner =+ waiting !== null && (!bannerDismissed || updateState.kind !== "available");return (<div className="window">@@ -158,7 +191,12 @@ export function App() {<NavItem active={section === "dock"} onSelect={() => setSection("dock")} glyph="▭">{t.dock}</NavItem>- <NavItem active={section === "system"} onSelect={() => setSection("system")} glyph="⚙">+ <NavItem+ active={section === "system"}+ onSelect={() => setSection("system")}+ glyph="⚙"+ badge={waiting ? t.updateBadge : undefined}+ >{t.system}</NavItem></nav>@@ -168,6 +206,18 @@ export function App() {<header className="content-title" data-tauri-drag-region>{section === "dock" ? t.dock : t.system}</header>+ {showBanner && waiting ? (+ <UpdateBanner+ t={t}+ info={waiting}+ progress={updateState.kind === "installing" ? updateState.progress : null}+ installing={updateState.kind === "installing"}+ failed={updateState.kind === "installFailed"}+ onInstall={() => install(waiting)}+ onLater={() => setBannerDismissed(true)}+ onNotes={() => showNotes(waiting)}+ />+ ) : null}<div className="content-body">{section === "dock" ? (<>@@ -291,8 +341,8 @@ export function App() {</Card><Card><Row label={t.updates} hint={updateHint(t, updateState, version)}>- {updateState.kind === "available" ? (- <button type="button" className="push push-primary" onClick={install}>+ {waiting && updateState.kind !== "installing" ? (+ <button type="button" className="push push-primary" onClick={() => install(waiting)}>{t.updatesInstall}</button>) : (@@ -338,9 +388,11 @@ function updateHint(t: Texts, state: UpdateState, version: string): string {case "current":return t.updatesCurrent.replace("{version}", version);case "available":- return t.updatesAvailable.replace("{version}", state.version);+ return t.updatesAvailable.replace("{version}", state.info.version);case "installing":return t.updatesInstalling;+ case "installFailed":+ return t.updateInstallError;case "error":return t.updatesError;}@@ -350,10 +402,12 @@ interface NavItemProps {active: boolean;glyph: string;onSelect: () => void;+ /** Accessible text of a red badge, as macOS shows for a pending update. */+ badge?: string;children: string;}-function NavItem({ active, glyph, onSelect, children }: NavItemProps) {+function NavItem({ active, glyph, onSelect, badge, children }: NavItemProps) {return (<buttontype="button"@@ -365,6 +419,11 @@ function NavItem({ active, glyph, onSelect, children }: NavItemProps) {{glyph}</span>{children}+ {badge ? (+ <span className="nav-badge" role="img" aria-label={badge}>+ 1+ </span>+ ) : null}</button>);}diff --git a/apps/settings/src/UpdateBanner.tsx b/apps/settings/src/UpdateBanner.tsxnew file mode 100644index 0000000..df80369--- /dev/null+++ b/apps/settings/src/UpdateBanner.tsx@@ -0,0 +1,82 @@+import type { UpdateInfo } from "./config";+import type es from "./i18n/es.json";++type Texts = typeof es;++interface UpdateBannerProps {+ t: Texts;+ info: UpdateInfo;+ /** Download share from 0 to 1 while installing, `null` if the size is unknown. */+ progress: number | null;+ installing: boolean;+ failed: boolean;+ onInstall: () => void;+ onLater: () => void;+ onNotes: () => void;+}++/**+ * The software-update card that sits above every section while an update is+ * waiting, as in macOS System Settings: it never blocks the window, and+ * "Later" only hides it until Settings is opened again.+ */+export function UpdateBanner({+ t,+ info,+ progress,+ installing,+ failed,+ onInstall,+ onLater,+ onNotes,+}: UpdateBannerProps) {+ const percent = progress === null ? null : Math.round(progress * 100);+ const detail = installing+ ? percent === null+ ? t.updateDownloadingUnknown+ : t.updateDownloading.replace("{percent}", String(percent))+ : failed+ ? t.updateInstallError+ : t.updateBannerBody;++ return (+ <section className="update" role="status" aria-live="polite">+ <span className="update-icon" aria-hidden="true">+ ↓+ </span>+ <div className="update-text">+ <p className="update-title">{t.updateBannerTitle.replace("{version}", info.version)}</p>+ <p className={failed ? "update-detail update-detail-error" : "update-detail"}>{detail}</p>+ {installing ? (+ <div+ className={percent === null ? "update-progress is-unknown" : "update-progress"}+ role="progressbar"+ aria-label={t.updateNow}+ aria-valuemin={0}+ aria-valuemax={100}+ aria-valuenow={percent ?? undefined}+ >+ <span style={{ width: `${percent ?? 35}%` }} />+ </div>+ ) : null}+ </div>+ {installing ? null : (+ <div className="update-actions">+ {info.notes ? (+ <button type="button" className="update-link" onClick={onNotes}>+ {t.updateWhatsNew}+ </button>+ ) : null}+ {failed ? null : (+ <button type="button" className="push" onClick={onLater}>+ {t.updateLater}+ </button>+ )}+ <button type="button" className="push push-primary" onClick={onInstall}>+ {failed ? t.updateRetry : t.updateNow}+ </button>+ </div>+ )}+ </section>+ );+}diff --git a/apps/settings/src/config.ts b/apps/settings/src/config.tsindex 390b940..7b25a63 100644--- a/apps/settings/src/config.ts+++ b/apps/settings/src/config.ts@@ -30,6 +30,13 @@ export const defaultConfig = () => invoke<Config>("default_config");export const saveConfig = (config: Config) => invoke<Config>("set_config", { config });export const getAutostart = () => invoke<boolean>("get_autostart");export const setAutostart = (enabled: boolean) => invoke<void>("set_autostart", { enabled });+export interface UpdateInfo {+ version: string;+ /** Release page with the notes, if the manifest has one. */+ notes: string | null;+}+/** Resolves to the newer version available, or null when up to date. */-export const checkUpdate = () => invoke<string | null>("check_update");+export const checkUpdate = () => invoke<UpdateInfo | null>("check_update");+export const openReleaseNotes = (url: string) => invoke<void>("open_release_notes", { url });export const installUpdate = () => invoke<void>("install_update");diff --git a/apps/settings/src/i18n/en.json b/apps/settings/src/i18n/en.jsonindex 3d137a1..ff1ab43 100644--- a/apps/settings/src/i18n/en.json+++ b/apps/settings/src/i18n/en.json@@ -41,5 +41,15 @@"resetHint": "Back to the out-of-the-box look and behavior. Your pinned apps stay.","resetConfirmHint": "Click again to confirm.","resetButton": "Restore",- "resetConfirm": "Confirm"+ "resetConfirm": "Confirm",+ "updateBannerTitle": "Muelle {version} is available",+ "updateBannerBody": "It brings improvements and fixes. It installs in seconds and the dock comes back on its own.",+ "updateNow": "Update now",+ "updateLater": "Later",+ "updateRetry": "Try again",+ "updateWhatsNew": "What's new",+ "updateDownloading": "Downloading… {percent}%",+ "updateDownloadingUnknown": "Downloading…",+ "updateInstallError": "The update could not be installed. Check your connection and try again.",+ "updateBadge": "Update available"}diff --git a/apps/settings/src/i18n/es.json b/apps/settings/src/i18n/es.jsonindex 2a03549..c3c931b 100644--- a/apps/settings/src/i18n/es.json+++ b/apps/settings/src/i18n/es.json@@ -41,5 +41,15 @@"resetHint": "Vuelve al aspecto y comportamiento de fábrica. Tus apps fijadas se mantienen.","resetConfirmHint": "Pulsa otra vez para confirmar.","resetButton": "Restablecer",- "resetConfirm": "Confirmar"+ "resetConfirm": "Confirmar",+ "updateBannerTitle": "Muelle {version} ya está disponible",+ "updateBannerBody": "Trae mejoras y correcciones. Se instala en unos segundos y el dock vuelve solo.",+ "updateNow": "Actualizar ahora",+ "updateLater": "Más tarde",+ "updateRetry": "Reintentar",+ "updateWhatsNew": "Novedades",+ "updateDownloading": "Descargando… {percent} %",+ "updateDownloadingUnknown": "Descargando…",+ "updateInstallError": "No se pudo instalar la actualización. Revisa la conexión e inténtalo de nuevo.",+ "updateBadge": "Actualización disponible"}diff --git a/apps/settings/src/styles.css b/apps/settings/src/styles.cssindex fd5bc2a..99e2341 100644--- a/apps/settings/src/styles.css+++ b/apps/settings/src/styles.css@@ -60,6 +60,9 @@ input:focus-visible {.window {display: grid;grid-template-columns: 200px 1fr;+ /* One row exactly as tall as the window, so the content scrolls inside it+ instead of growing past the bottom edge. */+ grid-template-rows: minmax(0, 1fr);height: 100%;}@@ -129,6 +132,7 @@ input:focus-visible {flex-direction: column;background: var(--content);min-width: 0;+ min-height: 0;}.content-title {@@ -138,8 +142,122 @@ input:focus-visible {}.content-body {+ flex: 1;+ min-height: 0;padding: 4px 24px 24px;overflow-y: auto;+ overscroll-behavior: contain;+}++/* Software update card, above every section while an update waits. */+.update {+ display: grid;+ grid-template-columns: auto minmax(0, 1fr);+ align-items: start;+ column-gap: 12px;+ margin: 0 24px 14px;+ padding: 12px 14px;+ border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);+ border-radius: 10px;+ background: color-mix(in srgb, var(--accent) 12%, var(--card));+}++.update-icon {+ display: grid;+ flex: none;+ place-items: center;+ width: 30px;+ height: 30px;+ border-radius: 50%;+ background: var(--accent);+ color: #fff;+ font-size: 15px;+ font-weight: 700;+}++.update-text {+ flex: 1;+ min-width: 0;+}++.update-title {+ margin: 0;+ font-weight: 600;+}++.update-detail {+ margin: 2px 0 0;+ font-size: 12px;+ color: var(--text-dim);+}++.update-detail-error {+ color: #ff453a;+}++.update-progress {+ height: 4px;+ margin-top: 8px;+ overflow: hidden;+ border-radius: 2px;+ background: var(--track);+}++.update-progress span {+ display: block;+ height: 100%;+ border-radius: 2px;+ background: var(--accent);+ transition: width 0.2s ease;+}++.update-progress.is-unknown span {+ animation: update-indeterminate 1.2s ease-in-out infinite;+}++@keyframes update-indeterminate {+ from {+ transform: translateX(-100%);+ }+ to {+ transform: translateX(300%);+ }+}++/* Under the text, so a long title never squeezes into several lines. */+.update-actions {+ grid-column: 2;+ display: flex;+ align-items: center;+ gap: 8px;+ margin-top: 10px;+}++.update-actions .update-link {+ margin-right: auto;+}++.update-link {+ color: var(--accent);+ font-size: 12px;+}++.update-link:hover {+ text-decoration: underline;+}++.nav-badge {+ display: grid;+ place-items: center;+ min-width: 18px;+ height: 18px;+ margin-left: auto;+ padding: 0 5px;+ border-radius: 9px;+ background: #ff3b30;+ color: #fff;+ font-size: 11px;+ font-weight: 700;}.card {@@ -287,7 +405,12 @@ input:focus-visible {@media (prefers-reduced-motion: reduce) {.toggle,- .toggle-knob {+ .toggle-knob,+ .update-progress span {transition: none;}++ .update-progress.is-unknown span {+ animation: none;+ }}diff --git a/crates/muelle-core/src/genie.rs b/crates/muelle-core/src/genie.rsindex 118472b..78446c2 100644--- a/crates/muelle-core/src/genie.rs+++ b/crates/muelle-core/src/genie.rs@@ -48,12 +48,14 @@ fn smoothstep(x: f32) -> f32 {impl Genie {/// How far the side edges have bent toward the slot at time `t` (0..=1).- fn bend(t: f32) -> f32 {+ #[must_use]+ pub fn bend(t: f32) -> f32 {smoothstep(t / BEND_END)}/// How far the image has slid into the slot at time `t` (0..=1).- fn slide(t: f32) -> f32 {+ #[must_use]+ pub fn slide(t: f32) -> f32 {let x = ((t - SLIDE_START) / (1.0 - SLIDE_START)).clamp(0.0, 1.0);// Accelerating, like something being pulled in.x * x