A lightweight, macOS-style dock for Windows 11, with glass visuals, smooth magnification, and Genie effect.
Merge upstream/main (v0.1.13, v0.1.14) into Stack
AzureAD\davidlamaa62e515aaace
diff --cc CHANGELOG.mdindex 0107ab5,1e67dd2..9283ebf--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -10,56 -10,112 +10,160 @@@ copia la sección de la versión que s### English+- Dock groups: drag a pinned app onto the middle of another one (a blue frame+ shows it) to put both in a group that takes a single place in the dock;+ drop more apps on the group to add them. A group shows its first apps'+ icons on a framed tile, and lists their names on hover. Clicking it fans+ its apps out above it (a grid when there are many); drag one out of the+ fan to take it out of the group, into the dock where it is dropped.+ Right-click a group to ungroup it.+- Shortcuts folder: choose a folder in Settings → Dock and it shows at the+ right of the dock. Clicking it opens its contents as a menu, as a Windows 10+ taskbar toolbar did: folders first, each one a submenu, then files, with+ Explorer's names and icons; choosing an item opens it. Right-click it to+ open the folder, change it or remove it.+- French: the dock, Settings and the installer are now also in French. Choose+ it in Settings → System, or leave Automatic to follow Windows. A language+ Muelle does not know in the settings file now reads as Automatic instead of+ making the file invalid.+- Apps that showed a blank page instead of their icon now show it, as on the+ taskbar: LibreOffice (its windows belong to `soffice.bin`; the dock now+ shows LibreOffice Calc, Writer… with their names and icons), and programs+ whose icon the Windows shell cannot draw although it is valid (one made+ only of PNG images, as some Electron tools write). Icons are read again+ once after updating.+### Español+- Grupos en el dock: arrastra una app fijada al centro de otra (un marco azul+ lo indica) para reunirlas en un grupo que ocupa un solo lugar en el dock;+ suelta más apps sobre el grupo para añadirlas. Un grupo muestra los iconos+ de sus primeras apps en un mosaico enmarcado, y sus nombres al pasar el+ puntero. Al hacer clic se despliegan en abanico encima (en cuadrícula si son+ muchas); arrastra una fuera del abanico para sacarla del grupo, al lugar del+ dock donde la sueltes. Clic derecho en un grupo para desagruparlo.+- Carpeta de accesos directos: elige una carpeta en Ajustes → Dock y aparece+ a la derecha del dock. Al hacer clic, su contenido se abre como un menú,+ como una barra de herramientas de la barra de tareas de Windows 10: primero+ las carpetas, cada una un submenú, luego los archivos, con los nombres e+ iconos del Explorador; al elegir un elemento se abre. Clic derecho para+ abrir la carpeta, cambiarla o quitarla.+- Francés: el dock, Ajustes y el instalador también están en francés.+ Elígelo en Ajustes → Sistema, o deja Automático para seguir a Windows. Un+ idioma que Muelle no conoce en el archivo de ajustes ahora se lee como+ Automático en lugar de invalidar el archivo.+- Las apps que mostraban una página en blanco en lugar de su icono ahora lo+ muestran, como en la barra de tareas: LibreOffice (sus ventanas pertenecen+ a `soffice.bin`; el dock ahora muestra LibreOffice Calc, Writer… con sus+ nombres e iconos) y los programas cuyo icono el shell de Windows no sabe+ dibujar aunque sea válido (uno hecho solo de imágenes PNG, como escriben+ algunas herramientas de Electron). Los iconos se vuelven a leer una vez+ tras actualizar.++ ## [0.1.14]++ ### English++ - Clicking an app whose minimized window is still reported as foreground now+ restores it on the first click, including with one app open and minimized+ previews disabled (#12). File drag-hover uses the same native-state check.++ - Automatic startup retries up to three times after a failed launch. Existing+ enabled tasks receive the recovery policy without enabling disabled tasks or+ changing the installation they launch. Settings checks the real registration.+ - If Explorer has not created its taskbar yet, Muelle retries taking it over+ without blocking the interface or saving a false original taskbar setting.+ - Startup failures before graphics initialization are now recorded in the log.+ - Dock window previews keep their positions when switching or minimizing+ windows. Newly discovered windows append; closed windows are removed. Normal+ icon activation continues to use the most recently used window.++ ### Español++ - Pulsar el icono de una app minimizada que Windows aún indica como activa+ ahora la restaura al primer clic, incluso con una sola app abierta y las+ miniaturas de minimizadas desactivadas (#12). El arrastre sobre un icono+ utiliza la misma comprobación del estado real de la ventana.++ - El inicio automático reintenta hasta tres veces si falla el arranque. Las+ tareas activadas reciben esta recuperación sin reactivar tareas deshabilitadas+ ni cambiar la instalación que ejecutan. Ajustes consulta el registro real.+ - Si Explorer todavía no ha creado su barra, Muelle vuelve a intentar ocultarla+ sin bloquear la interfaz ni guardar un estado original incorrecto.+ - El registro también recoge fallos anteriores a la inicialización gráfica.++ - Las previsualizaciones del dock conservan su posición al cambiar de ventana+ o minimizarla. Las ventanas nuevas se añaden al final y las cerradas se retiran.+ El clic normal del icono sigue recuperando la ventana usada más recientemente.++ ## [0.1.13]++ ### English++ - The menu bar's keyboard indicator opens a themed layout menu with the+ current keyboard marked and a link to Windows language settings. Changes+ are requested for the original typing window instead of simulating Win+Space.+ - Changing Muelle's language refreshes menu bar text even when its data has+ not changed. Menu bar controls retain the standard arrow cursor.+ - Menus return focus after a selection without overriding another app the+ user switched to while dismissing them. Auto-hide keeps the menu bar open+ while its keyboard selector is in use.++ - With auto-hide enabled, rest the pointer at a display's bottom edge to+ bring the Dock to that display (#9, #11).+ - Menu bar redraws no longer cancel a pending top-edge reveal (#10).+ - Screen-edge detection reads the cursor on a dedicated timer thread while+ auto-hide is active, including when the cursor is already at the edge.+ - Auto-hidden menu bars verify the cursor position before closing on+ mouse-leave notifications, with a pointer check only while the bar is revealed.+ - The menu bar reveals after a shorter edge dwell and slides/fades in and+ out using the Windows compositor. Returning during its exit reverses the+ transition; Windows' disabled animation setting is respected.+ - Show/hide transitions wait for compositor completion and keep hidden content+ transparent, preventing cached-frame flashes. Auto-hide also applies before+ the menu bar's first frame at startup.+ - Closing a dock context menu resets hover and resumes auto-hide when the+ pointer is outside the dock. File drags keep the dock open.+ - Dock and Settings writes are serialized. Changing a preference preserves+ recent pin changes and the dock's latest auto-hide setting. Closing+ Settings waits for pending edits to be saved.+ - Taking over the Windows taskbar after resume or an Explorer restart runs+ in the background, as it does at startup.++ ### Español++ - El indicador de teclado de la barra abre un menú con el estilo de Muelle,+ marca el teclado activo y permite abrir los ajustes de idioma de Windows.+ El cambio se solicita a la ventana donde se escribía, sin simular Win+Espacio.+ - Cambiar el idioma de Muelle actualiza los textos de la barra aunque no+ cambien sus datos. Los controles de la barra mantienen el cursor de flecha.+ - Los menús devuelven el foco tras una selección sin imponerse a otra app+ elegida al cerrarlos. La barra permanece visible mientras se usa su+ selector de teclado, incluso con ocultación automática.++ - Con la ocultación automática activada, deja el puntero en el borde inferior+ de una pantalla para mostrar el Dock allí (#9, #11).+ - Actualizar la barra superior ya no cancela su aparición al dejar el puntero+ en el borde (#10).+ - La detección del borde consulta el puntero desde un hilo con temporizador+ mientras está activa la ocultación automática, incluso si ya está en el borde.+ - Los avisos de salida de la barra superior verifican la posición real del+ puntero antes de cerrarla, con una comprobación solo mientras está desplegada.+ - La barra aparece con una espera menor en el borde y transiciones de+ deslizamiento y opacidad mediante el compositor de Windows. Volver durante+ la salida la invierte; respeta la desactivación de animaciones de Windows.+ - La salida espera a que termine realmente la animación del compositor y el+ contenido permanece transparente al ocultarse, evitando destellos de fotogramas+ anteriores. La auto-ocultación se aplica desde el primer fotograma al iniciar.+ - Al cerrar un menú contextual fuera del dock se restablece el puntero y+ vuelve a funcionar la ocultación automática. Al arrastrar archivos, el+ dock permanece abierto.+ - El dock y Ajustes guardan por turnos. Cambiar una preferencia conserva+ los pines y el estado de ocultación más recientes. Ajustes guarda los+ cambios pendientes antes de cerrarse.+ - Recuperar la barra de tareas tras reanudar Windows o reiniciar el+ Explorador se ejecuta en segundo plano, igual que en el inicio.+## [0.1.12]### Englishdiff --cc apps/dock/src/app.rsindex 0fbea7b,cd70a3c..081e881--- a/apps/dock/src/app.rs+++ b/apps/dock/src/app.rs@@@ -92,10 -90,9 +93,11 @@@ use windows::use crate::{assets::{Visuals, fallback_name},drop::DropTarget,+ edge_watch::{self, EdgeWatch, Reveal, Target as EdgeTarget},flight::{Flight, Snapshot},+ folder_menu,gfx::{Gfx, LabelBrush},+ group_view::{DragGhost, GroupItem, GroupView, Placement, Released},mascot,menu::{self, MenuItem},menubar::MenuBar,@@@ -366,12 -350,11 +370,17 @@@ enum Outsidecopy: bool,},Menu(MenuRequest),+ /// The shortcuts folder's contents, as a menu above its icon.+ FolderMenu {+ folder: String,+ anchor: POINT,+ dark: bool,+ },+ InputMenu {+ gfx: Gfx,+ anchor: POINT,+ dark: bool,+ },QuitDock,OpenSettings,OpenAsAdmin(String),@@@ -603,13 -632,7 +664,14 @@@ struct Apphovered: Option<usize>,preview_candidate: Option<String>,preview: Option<MultiWindowView>,+ /// A group's apps, unfolded above it after a click.+ group_view: Option<GroupView>,+ /// The group whose view a press on the dock closed: releasing on that+ /// group then leaves it closed rather than opening it again.+ group_was_open: Option<String>,+ /// The icon following the pointer while an app is dragged out of a group.+ ghost: Option<DragGhost>,+ menu_open: bool,/// The crab, while it is out (see `perform`).mascot: Option<mascot::Mascot>,/// Charging and energy saver at the last power change.@@@ -683,30 -697,25 +749,44 @@@ fn roster_from(config: &Config) -> Rost}fn save_settings(roster: &Roster, config: &Config) {- let path = muelle_config::default_path();- if let Err(error) = muelle_config::load(&path) {- // Do not overwrite a corrupted file; report it and skip saving.- eprintln!("muelle: {error}; no se guardan los cambios del dock");- return;+ if let Err(error) = save_dock_config(roster, config, false) {+ eprintln!("muelle: {error}");}- let config = Config {- pinned: roster.pinned().to_vec(),- groups: roster+ }++ fn save_dock_config(roster: &Roster, config: &Config, toggle_hide: bool) -> Result<Config> {+ let saved = muelle_config::update(&muelle_config::default_path(), |saved| {+ let mut saved = saved.unwrap_or_else(|| config.clone());+ saved.pinned = roster.pinned().to_vec();++ saved.groups = roster+ .groups()+ .iter()+ .map(|group| DockGroup {+ id: group.id.clone(),+ apps: group.apps.clone(),+ })- .collect(),- recent: roster.recent().to_vec(),- ..config.clone()- };- if let Err(error) = muelle_config::save(&path, &config) {- eprintln!("muelle: {error}");- }++ .collect();+ saved.recent = roster.recent().to_vec();+ saved.taskbar_pins.clone_from(&config.taskbar_pins);+ if toggle_hide {+ saved.auto_hide = !saved.auto_hide;+ }+ Ok(saved)+ })?;+ Ok(saved)+ }+++/// Takes the shortcuts folder out of the dock. Only that preference changes++/// on disk: Settings owns the others and may have changed them since.++fn forget_shortcuts_folder(config: &Config) -> Result<()> {++ muelle_config::update(&muelle_config::default_path(), |saved| {++ let mut saved = saved.unwrap_or_else(|| config.clone());++ saved.shortcuts_folder = None;++ Ok(saved)++ })?;++ Ok(())+}+fn shorten(text: &str, max: usize) -> String {if text.chars().count() <= max {text.to_owned()@@@ -1255,12 -1154,11 +1353,12 @@@ impl Applet slide = self.slide.value * stage.slide_distance;stage.scene.apply(&Frame {state: &state,-- hovered: self-- .hovered- .filter(|&index| self.preview.is_none() && open_group != Some(index)),- .filter(|_| self.preview.is_none() && !self.menu_open),++ hovered: self.hovered.filter(|&index| {++ self.preview.is_none() && !self.menu_open && open_group != Some(index)++ }),lifts: &lifts,drag,+ target,slide,snap: at_rest,})?;@@@ -2613,253 -2435,40 +2712,253 @@@let (Some(id), role) = (entry.id.clone(), entry.role) else {return Ok(None);};- let windows = self.windows_of(&id);+ Ok(match role {+ Role::App => self.click_app(id),+ // A click unfolds the group; another click on it folds it back.+ Role::Group => {+ if group_was_open.as_deref() != Some(id.as_str()) {+ self.open_group_view(&id)?;+ }+ None+ }+ Role::Start => Some(Outside::OpenStart),+ Role::Window => window_of(&id).and_then(|hwnd| self.activating(vec![hwnd])),+ Role::Shortcuts => self.folder_menu(id)?,+ Role::Folder | Role::Trash => Some(Outside::Open(id)),+ })+ }++ /// The shortcuts folder's menu, above its icon. The label hides while+ /// the menu is open, as for the context menu.+ fn folder_menu(&mut self, folder: String) -> Result<Option<Outside>> {+ let Some(anchor) = self.hovered.and_then(|index| self.anchor_above(index)) else {+ return Ok(None);+ };+ self.close_preview();+ self.close_group_view();+ self.hovered = None;+ self.hovering = false;+ self.render()?;+ Ok(Some(Outside::FolderMenu {+ folder,+ anchor,+ dark: !uses_light_theme(),+ }))+ }++ /// Where a menu for the icon at `index` opens: centered just above it.+ fn anchor_above(&self, index: usize) -> Option<POINT> {+ let stage = self.stage.as_ref()?;+ let state = magnify(+ &stage.layout,+ self.cursor,+ self.amount.value,+ &stage.magnifier,+ );+ let rect = state.rects.get(index)?;+ let gap = (stage.gap / 2.0).round() as i32;+ Some(POINT {+ x: stage.dock_origin.x + (rect.x + rect.width / 2.0).round() as i32,+ y: stage.dock_origin.y + rect.y.round() as i32 - gap,+ })+ }++ /// What clicking the app `id` does, in the dock or in an unfolded group:+ /// open it, bring its windows to the front, or minimize them if it is the+ /// app in front.+ fn click_app(&mut self, id: String) -> Option<Outside> {+ let windows = self.windows_of(&id);// As on the Windows taskbar: Shift+click opens another window of the// app, Ctrl+Shift+click opens it as administrator.- if role == Role::App {- // SAFETY: Read-only keyboard state queries.- let (shift, ctrl) = unsafe {- (- GetKeyState(i32::from(VK_SHIFT.0)) < 0,- GetKeyState(i32::from(VK_CONTROL.0)) < 0,- )- };- if shift {- self.start_bounce(id.clone(), None);- return Ok(Some(if ctrl {- Outside::OpenAsAdmin(id)- } else {- Outside::Open(id)- }));- }+ // SAFETY: Read-only keyboard state queries.+ let (shift, ctrl) = unsafe {+ (+ GetKeyState(i32::from(VK_SHIFT.0)) < 0,+ GetKeyState(i32::from(VK_CONTROL.0)) < 0,+ )+ };+ if shift {+ self.start_bounce(id.clone(), None);+ return Some(if ctrl {+ Outside::OpenAsAdmin(id)+ } else {+ Outside::Open(id)+ });}+ if windows.is_empty() {+ self.start_bounce(id.clone(), None);+ Some(Outside::Open(id))- } else if windows.contains(&tracker::foreground_window()) {++ } else if group_is_foreground(&windows, tracker::foreground_window()) {+ Some(Outside::Minimize(windows))+ } else {+ self.activating(windows)+ }+ }- Ok(match role {- Role::App if windows.is_empty() => {- self.start_bounce(id.clone(), None);- Some(Outside::Open(id))+ /// Unfolds the group `id` above its icon.+ fn open_group_view(&mut self, id: &str) -> Result<()> {+ self.close_preview();+ self.close_group_view();+ let Some(stage) = &self.stage else {+ return Ok(());+ };+ let Some(index) = self+ .entries+ .iter()+ .position(|entry| entry.id.as_deref() == Some(id))+ else {+ return Ok(());+ };+ let state = magnify(+ &stage.layout,+ self.cursor,+ self.amount.value,+ &stage.magnifier,+ );+ let Some(rect) = state.rects.get(index) else {+ return Ok(());+ };+ let anchor = RECT {+ left: stage.dock_origin.x + rect.x.round() as i32,+ top: stage.dock_origin.y + rect.y.round() as i32,+ right: stage.dock_origin.x + (rect.x + rect.width).round() as i32,+ bottom: stage.dock_origin.y + (rect.y + rect.height).round() as i32,+ };+ let (icon, scale) = (stage.icon.round(), stage.scale);+ let theme = Theme::for_system(stage.key.light, stage.key.glass);+ let Some(monitor) = primary_monitor() else {+ return Ok(());+ };+ let items = self.group_items(id, icon as u32);+ self.group_view = Some(GroupView::show(+ &self.gfx,+ id.to_owned(),+ &items,+ &Placement {+ anchor,+ screen: monitor.screen,+ scale,+ icon,+ theme,+ dock: self.input,+ },+ )?);+ self.render()+ }++ /// The apps of the group `id`, drawn `side` pixels wide.+ fn group_items(&mut self, id: &str, side: u32) -> Vec<GroupItem> {+ let apps = self+ .roster+ .group(id)+ .map(|group| group.apps.clone())+ .unwrap_or_default();+ let mut items = Vec::with_capacity(apps.len());+ for app in apps {+ let visual = self.icons.get(&app, "");+ let icon = visual+ .and_then(|visual| {+ self.gfx+ .icon_brush(&visual.icon, side.min(visual.icon.width))+ .inspect_err(|error| eprintln!("muelle: icono de `{app}`: {error:#}"))+ .ok()+ })+ .or_else(|| self.placeholder.clone());+ let name = visual.map_or_else(|| fallback_name(&app), |visual| visual.name.clone());+ items.push(GroupItem {+ running: self.roster.is_running(&app),+ id: app,+ name,+ icon,+ });+ }+ items+ }++ fn close_group_view(&mut self) {+ if self.group_view.take().is_some()+ && self.config.auto_hide+ && !self.hovering+ && self.drag.is_none()+ {+ // SAFETY: Timer on our own window.+ unsafe { SetTimer(Some(self.input), HIDE_TIMER, HIDE_DELAY_MS, None) };+ }+ }++ /// The pointer moved over the unfolded group: past the drag threshold,+ /// the app pressed leaves the group.+ fn group_view_moved(&mut self) -> Result<()> {+ let Some(view) = &mut self.group_view else {+ return Ok(());+ };+ if let Some((id, point)) = view.drag_started()? {+ return self.start_group_drag(id, point);+ }+ view.update()+ }++ /// An app dragged out of an unfolded group: it leaves the group for the+ /// dock, right after the group, and the drag goes on as a dock drag. So+ /// it can be placed among the icons or dropped on another group, and+ /// released anywhere else it simply stays out of the group.+ fn start_group_drag(&mut self, id: String, point: POINT) -> Result<()> {+ // Closing the view also releases the mouse it held.+ self.close_group_view();+ if !self.roster.ungroup(&id) {+ return Ok(());+ }+ let side = self.stage.as_ref().map_or(48.0, |stage| {+ (stage.icon * stage.magnifier.max_scale).round()+ });+ let brush = self+ .icons+ .get(&id, "")+ .and_then(|visual| {+ self.gfx+ .icon_brush(&visual.icon, (side as u32).min(visual.icon.width))+ .ok()+ })+ .or_else(|| self.placeholder.clone());+ self.ghost = brush.and_then(|brush| {+ DragGhost::show(&self.gfx, &brush, side, point)+ .inspect_err(|error| eprintln!("muelle: icono arrastrado: {error:#}"))+ .ok()+ });+ self.press = None;+ self.drag = Some(Dragging {+ id,+ point,+ removing: false,+ merge: None,+ from_group: true,+ });+ self.refresh()?;+ if let Some(stage) = &self.stage {+ self.cursor = (point.x - stage.dock_origin.x) as f32;+ }+ // SAFETY: Capture keeps mouse input while dragging outside the dock.+ unsafe {+ SetCapture(self.input);+ }+ self.drag_to(point)+ }++ fn group_view_released(&mut self) -> Result<Option<Outside>> {+ let Some(view) = &mut self.group_view else {+ return Ok(None);+ };+ Ok(match view.release()? {+ Released::Item(id) => {+ self.close_group_view();+ self.click_app(id)}- Role::App if group_is_foreground(&windows, tracker::foreground_window()) => {- Some(Outside::Minimize(windows))+ Released::Dismiss => {+ self.close_group_view();+ None}- Role::App => self.activating(windows),- Role::Start => Some(Outside::OpenStart),- Role::Window => window_of(&id).and_then(|hwnd| self.activating(vec![hwnd])),- Role::Folder | Role::Trash => Some(Outside::Open(id)),+ Released::Nothing => None,})}@@@ -2918,8 -2492,10 +3017,11 @@@/// Right-click prepares the menu for the item under the cursor, or the dock/// menu when over empty space or a divider.fn on_right_click(&mut self) -> Result<Option<Outside>> {+ if self.menu_open {+ return Ok(None);+ }self.close_preview();+ self.close_group_view();if self.pointer_at_click()?.is_none() {return Ok(None);}@@@ -3096,13 -2644,6 +3194,15 @@@launcher::close(&window_of(&id).into_iter().collect::<Vec<_>>());None}+ CMD_SETTINGS => Some(Outside::OpenSettings),+ CMD_REMOVE_FOLDER => {++ if let Err(error) = forget_shortcuts_folder(&self.config) {++ eprintln!("muelle: {error}");++ }+ self.config.shortcuts_folder = None;- save_settings(&self.roster, &self.config);+ self.refresh()?;+ None+ }CMD_OPEN => {if role == Role::App {self.start_bounce(id.clone(), None);@@@ -3525,9 -3260,8 +3821,9 @@@let previous = self.fullscreen;self.fullscreen = fullscreen;if fullscreen {+ self.stop_mascot();+ self.close_preview();++ self.close_group_view();self.hovering = false;self.amount = Spring::at(0.0, HOVER_OMEGA);self.press = None;@@@ -3740,50 -3476,16 +4039,55 @@@ pub fn multi_window_view_dismiss()});}+pub fn group_view_tick() {+ with_app("grupo", |app| {+ if let Some(view) = &mut app.group_view+ && !view.tick()?+ {+ app.close_group_view();+ }+ Ok(())+ });+}++pub fn group_view_press() {+ with_app("grupo", |app| match &mut app.group_view {+ Some(view) => view.press(),+ None => Ok(()),+ });+}++pub fn group_view_moved() {+ with_app("arrastre desde un grupo", App::group_view_moved);+}++pub fn group_view_release() {+ with_app_then("abrir desde un grupo", App::group_view_released);+}++pub fn group_view_menu() {+ with_app_then("menú de un grupo", App::group_view_menu);+}++pub fn group_view_press_lost() {+ with_app("grupo", |app| {+ if let Some(view) = &mut app.group_view {+ view.cancel_press();+ }+ Ok(())+ });+}+- /// The pointer rested on the top edge with the menu bar hidden.- pub fn menu_bar_edge_rested() {- with_app("barra superior", |app| match &mut app.menubar {- Some(bar) => bar.edge_rested(&app.gfx),- None => Ok(()),+ pub fn menu_bar_check_pointer() {+ with_app("barra superior", |app| {+ if app.menu_open {+ Ok(())+ } else {+ match &mut app.menubar {+ Some(bar) => bar.check_pointer(&app.gfx),+ None => Ok(()),+ }+ }});}@@@ -3955,17 -3706,6 +4308,21 @@@ fn run_outside(outside: Outside)});}}+ Outside::FolderMenu {+ folder,+ anchor,+ dark,+ } => {++ with_app("abrir carpeta de accesos directos", |app| {++ app.menu_open = true;++ app.render()++ });+ let chosen = folder_menu::show(main_window(), &folder, anchor, dark);+ with_app("menú cerrado", App::after_menu);+ if let Some(path) = chosen {+ submit(ShellAction::Open { id: path });+ }+ }}}@@@ -4330,9 -4087,7 +4706,10 @@@ pub fn run() -> Result<()>hovered: None,preview_candidate: None,preview: None,+ group_view: None,+ group_was_open: None,+ ghost: None,+ menu_open: false,mascot: None,// Initial registration notifications establish the baseline after// the queue starts, without playing a startup charging/saver act.diff --cc apps/dock/src/main.rsindex 0edbf99,2d97a8d..0bd9fdd--- a/apps/dock/src/main.rs+++ b/apps/dock/src/main.rs@@@ -14,10 -14,9 +14,11 @@@mod app;mod assets;mod drop;+ mod edge_watch;mod flight;+mod folder_menu;mod gfx;+mod group_view;mod guard;mod mascot;mod media;diff --cc apps/dock/src/menubar.rsindex eca2784,c4c2c14..be1ff91--- a/apps/dock/src/menubar.rs+++ b/apps/dock/src/menubar.rs@@@ -17,6 -17,6 +17,7 @@@//! and volume changes arrive as `STATUS_CHANGED`; nothing polls.use anyhow::Result;++use muelle_config::Language;use muelle_shell::{appbar::{AppBar, Edge},launcher,@@@ -170,6 -165,7 +166,7 @@@ struct Status/// What the bar was last drawn for.#[derive(Clone, PartialEq)]struct Look {- spanish: bool,++ language: Language,screen: RECT,scale: f32,light: bool,@@@ -1337,6 -1377,7 +1378,7 @@@ impl MenuBarusage.refresh(false);}let look = Look {- spanish: strings::is_spanish(),++ language: strings::language(),screen: monitor.screen,scale: monitor.scale,light: system::uses_light_theme(),@@@ -2471,6 -2517,223 +2518,226 @@@ impl Drop for MenuBarmod island_tests {use super::*;+ #[test]+ #[ignore = "Requires Windows desktop composition"]+ fn changing_ui_language_redraws_unchanged_menu_bar_content() -> Result<()> {- use muelle_config::Language;+ use windows::Win32::System::WinRT::{+ CreateDispatcherQueueController, DQTAT_COM_STA, DQTYPE_THREAD_CURRENT,+ DispatcherQueueOptions,+ };+ struct RestoreLanguage(Language);+ impl Drop for RestoreLanguage {+ fn drop(&mut self) {+ strings::set_language(self.0);+ }+ }- let _restore = RestoreLanguage(if strings::is_spanish() {- Language::Es- } else {- Language::En- });++ let _restore = RestoreLanguage(strings::language());+ let _queue = unsafe {+ CreateDispatcherQueueController(DispatcherQueueOptions {+ dwSize: size_of::<DispatcherQueueOptions>() as u32,+ threadType: DQTYPE_THREAD_CURRENT,+ apartmentType: DQTAT_COM_STA,+ })?+ };+ let gfx = Gfx::new()?;+ strings::set_language(Language::Es);+ let mut bar = MenuBar::create(&gfx, false, true)?;- assert!(bar.look.as_ref().is_some_and(|look| look.spanish));++ assert!(++ bar.look++ .as_ref()++ .is_some_and(|look| look.language == Language::Es)++ );+ let previous = bar.surface.Children()?.First()?.Current()?;+ strings::set_language(Language::En);+ bar.refresh(&gfx)?;+ assert_ne!(+ previous,+ bar.surface.Children()?.First()?.Current()?,+ "translation-only changes must rebuild the content"+ );- assert!(bar.look.as_ref().is_some_and(|look| !look.spanish));++ assert!(++ bar.look++ .as_ref()++ .is_some_and(|look| look.language == Language::En)++ );+ Ok(())+ }++ #[test]+ #[ignore = "Requires Windows desktop composition"]+ fn auto_hidden_bar_can_reveal_and_hide_repeatedly() -> Result<()> {+ use windows::Win32::{+ System::WinRT::{+ CreateDispatcherQueueController, DQTAT_COM_STA, DQTYPE_THREAD_CURRENT,+ DispatcherQueueOptions,+ },+ UI::WindowsAndMessaging::IsWindowVisible,+ };+ // SAFETY: The dispatcher and bar belong to this test thread.+ let _queue = unsafe {+ CreateDispatcherQueueController(DispatcherQueueOptions {+ dwSize: size_of::<DispatcherQueueOptions>() as u32,+ threadType: DQTYPE_THREAD_CURRENT,+ apartmentType: DQTAT_COM_STA,+ })?+ };+ let gfx = Gfx::new()?;+ let mut bar = MenuBar::create(&gfx, false, true)?;+ assert!(+ !unsafe { IsWindowVisible(bar.hwnd) }.as_bool(),+ "auto-hide must apply before the first frame"+ );+ bar.set_auto_hide(true)?;+ for _ in 0..3 {+ assert!(!unsafe { IsWindowVisible(bar.hwnd) }.as_bool());+ assert_eq!(+ bar.surface.Opacity()?,+ 0.0,+ "hidden content must stay transparent"+ );+ let point = POINT {+ x: (bar.bounds.left + bar.bounds.right) / 2,+ y: bar.bounds.top,+ };+ bar.edge_rested(&gfx, point)?;+ assert!(unsafe { IsWindowVisible(bar.hwnd) }.as_bool());+ // A queued leave from before the reveal must not hide it while+ // the pointer is still at the edge, including its first pixel.+ bar.pointer_left_at(&gfx, point)?;+ assert!(unsafe { IsWindowVisible(bar.hwnd) }.as_bool());+ let surface = bar.surface.clone();+ bar.set_app_name(&gfx, "Muelle regression test")?;+ assert_eq!(+ bar.surface, surface,+ "redraws must preserve the animation parent"+ );+ let outside = POINT {+ y: bar.bounds.bottom,+ ..point+ };+ bar.pointer_left_at(&gfx, outside)?;+ if bar.hide_until.is_some() {+ // Returning during the exit cancels it. Its already queued+ // completion must not close the bar after that reversal.+ bar.pointer_left_at(&gfx, point)?;+ let old_epoch = bar.animation_epoch;+ bar.finish_hide_at(+ &gfx,+ Instant::now() + Duration::from_secs(1),+ outside,+ Some(old_epoch.wrapping_sub(1)),+ )?;+ assert!(unsafe { IsWindowVisible(bar.hwnd) }.as_bool());+ bar.pointer_left_at(&gfx, outside)?;+ // An old completion must also be ignored during a newer exit.+ bar.finish_hide_at(+ &gfx,+ Instant::now() + Duration::from_secs(1),+ outside,+ Some(old_epoch),+ )?;+ assert!(unsafe { IsWindowVisible(bar.hwnd) }.as_bool());+ let epoch = bar.animation_epoch;+ bar.finish_hide_at(&gfx, Instant::now(), outside, None)?;+ assert!(unsafe { IsWindowVisible(bar.hwnd) }.as_bool());+ bar.finish_hide_at(&gfx, Instant::now(), outside, Some(epoch))?;+ }+ }+ assert!(!unsafe { IsWindowVisible(bar.hwnd) }.as_bool());+ bar.set_auto_hide(false)?;+ assert!(unsafe { IsWindowVisible(bar.hwnd) }.as_bool());+ bar.set_auto_hide(true)?;+ assert!(!unsafe { IsWindowVisible(bar.hwnd) }.as_bool());+ bar.edge_rested(+ &gfx,+ POINT {+ x: bar.bounds.right / 2,+ y: bar.bounds.top,+ },+ )?;+ bar.set_visible(false)?;+ assert!(!unsafe { IsWindowVisible(bar.hwnd) }.as_bool());+ assert!(bar.hide_until.is_none());+ bar.set_visible(true)?;+ assert!(!unsafe { IsWindowVisible(bar.hwnd) }.as_bool());+ Ok(())+ }++ #[test]+ #[ignore = "Requires Windows desktop composition; runs visible transitions"]+ fn compositor_completion_hides_only_the_current_exit() -> Result<()> {+ use windows::Win32::{+ System::WinRT::{+ CreateDispatcherQueueController, DQTAT_COM_STA, DQTYPE_THREAD_CURRENT,+ DispatcherQueueOptions,+ },+ UI::WindowsAndMessaging::{+ DispatchMessageW, IsWindowVisible, MSG, PM_REMOVE, PeekMessageW,+ },+ };+ // SAFETY: The dispatcher, queue, window and compositor are test-owned.+ let _queue = unsafe {+ CreateDispatcherQueueController(DispatcherQueueOptions {+ dwSize: size_of::<DispatcherQueueOptions>() as u32,+ threadType: DQTYPE_THREAD_CURRENT,+ apartmentType: DQTAT_COM_STA,+ })?+ };+ let gfx = Gfx::new()?;+ let mut bar = MenuBar::create(&gfx, false, true)?;+ bar.set_app_name(&gfx, "Muelle animation test")?;+ bar.set_auto_hide(true)?;+ let inside = POINT {+ x: bar.bounds.left + 100,+ y: bar.bounds.top,+ };+ let outside = POINT {+ y: bar.bounds.bottom + 50,+ ..inside+ };+ let pump = |bar: &mut MenuBar, duration: Duration, point: POINT| -> Result<usize> {+ let until = Instant::now() + duration;+ let mut completions = 0;+ let mut msg = MSG::default();+ while Instant::now() < until {+ // Pump the dispatcher so real compositor completion events run.+ // Pointer state is deterministic; no mouse input is injected.+ while unsafe { PeekMessageW(&mut msg, None, 0, 0, PM_REMOVE) }.as_bool() {+ if msg.hwnd == bar.hwnd && msg.message == HIDE_ANIMATION_DONE {+ completions += 1;+ bar.finish_hide_at(&gfx, Instant::now(), point, Some(msg.wParam.0))?;+ } else if msg.hwnd == bar.hwnd+ && msg.message == WM_TIMER+ && msg.wParam.0 == HIDE_ANIMATION_TIMER+ {+ bar.finish_hide_at(&gfx, Instant::now(), point, None)?;+ } else {+ unsafe { DispatchMessageW(&msg) };+ }+ }+ std::thread::sleep(Duration::from_millis(2));+ }+ Ok(completions)+ };+ pump(&mut bar, Duration::from_millis(300), outside)?;+ for _ in 0..3 {+ bar.hover(&gfx, true)?;+ pump(&mut bar, Duration::from_millis(500), inside)?;+ assert!(unsafe { IsWindowVisible(bar.hwnd) }.as_bool());+ bar.hover(&gfx, false)?;+ if system::animations_enabled() {+ assert!(unsafe { IsWindowVisible(bar.hwnd) }.as_bool());+ }+ let completions = pump(&mut bar, Duration::from_millis(500), outside)?;+ if system::animations_enabled() {+ assert_eq!(completions, 1, "exit must complete through the compositor");+ }+ assert!(!unsafe { IsWindowVisible(bar.hwnd) }.as_bool());+ assert_eq!(bar.surface.Opacity()?, 0.0);+ }+ Ok(())+ }+#[test]fn clicking_usage_replaces_music_and_clicking_again_closes_it() {let open = toggle_panel(Some(Island::Music), Island::Usage);diff --cc apps/dock/src/strings.rsindex 8155a95,086d993..7c07ce8--- a/apps/dock/src/strings.rs+++ b/apps/dock/src/strings.rs@@@ -1,5 -1,5 +1,5 @@@-//! User-facing dock text in Spanish and English. The language follows the-//! Windows display language unless the user overrides it in Settings.+//! User-facing dock text in Spanish, English and French. The language follows- //! the Windows display language unless Settings chooses one.++//! the Windows display language unless the user overrides it in Settings.//! `&` marks the menu access key.use std::sync::atomic::{AtomicU8, Ordering};@@@ -37,11 -36,9 +37,13 @@@ pub struct Stringspub usage_updated: &'static str,pub usage_used: &'static str,pub media_title: &'static str,+ pub folder_empty: &'static str,+ pub folder_unavailable: &'static str,+ pub change_folder: &'static str,+ pub remove_from_dock: &'static str,pub shell_operation_failed: &'static str,+ pub keyboard_settings: &'static str,+ pub keyboard: &'static str,}const ES: Strings = Strings {@@@ -112,75 -107,35 +118,93 @@@ const EN: Strings = Stringsusage_updated: "Updated",usage_used: "used",media_title: "Now playing",+ folder_empty: "(empty)",+ folder_unavailable: "Folder unavailable",+ change_folder: "&Change Folder…",+ remove_from_dock: "&Remove from Dock",};-/// 0 = not chosen yet (follow Windows), 1 = Spanish, 2 = English.+const FR: Strings = Strings {++ keyboard_settings: "Paramètres de langue et de clavier…",++ keyboard: "Clavier",+ shell_operation_failed: "L'opération n'a pas pu démarrer. Réessayez dans un instant.",+ open: "&Ouvrir",+ new_window: "&Nouvelle fenêtre",+ keep_in_dock: "&Garder dans le Dock",+ show_in_explorer: "Afficher dans l'&Explorateur",+ quit_app: "&Quitter",+ empty_bin: "&Vider la Corbeille",+ turn_hiding_on: "Activer le &masquage automatique",+ turn_hiding_off: "Désactiver le &masquage automatique",+ quit_dock: "&Quitter Muelle",+ start: "Démarrer",+ remove: "Retirer",+ close_window: "&Fermer",+ ungroup: "&Dégrouper",+ settings: "&Réglages de Muelle…",+ run_as_admin: "Exécuter en tant qu'&administrateur",+ show_desktop: "Afficher le &Bureau",+ task_manager: "&Gestionnaire des tâches",+ taskbar_settings: "Paramètres de la barre des &tâches",+ usage_title: "Utilisation de l'IA",+ usage_refresh: "Actualiser",+ usage_refreshing: "Actualisation…",+ usage_sign_in: "Se connecter",+ usage_unavailable: "Indisponible",+ usage_loading: "Chargement…",+ usage_stale: "Non actualisé",+ usage_resets: "Remise à zéro le",+ usage_updated: "Actualisé il y a",+ usage_used: "utilisé",+ media_title: "En cours de lecture",+ folder_empty: "(vide)",+ folder_unavailable: "Dossier introuvable",+ change_folder: "&Changer de dossier…",+ remove_from_dock: "&Retirer du Dock",+};++/// 0 = not chosen yet (follow Windows), 1 = Spanish, 2 = English, 3 = French.static LANGUAGE: AtomicU8 = AtomicU8::new(0);pub fn set_language(language: Language) {- let spanish = match language {- Language::Auto => ui_language_is_spanish(),- Language::Es => true,- Language::En => false,+ let chosen = match language {+ Language::Auto => ui_language(),+ Language::Es => UiLanguage::Spanish,+ Language::En => UiLanguage::English,+ Language::Fr => UiLanguage::French,+ };+ let stored = match chosen {+ UiLanguage::Spanish => 1,+ UiLanguage::English => 2,+ UiLanguage::French => 3,};- LANGUAGE.store(if spanish { 1 } else { 2 }, Ordering::Relaxed);+ LANGUAGE.store(stored, Ordering::Relaxed);}+ fn chosen_language() -> u8 {+ let language = LANGUAGE.load(Ordering::Relaxed);+ if language == 0 {+ set_language(Language::Auto);+ LANGUAGE.load(Ordering::Relaxed)+ } else {+ language+ }+ }+pub fn text() -> &'static Strings {- match LANGUAGE.load(Ordering::Relaxed) {- 0 => {- set_language(Language::Auto);- text()- }- if chosen_language() == 1 { &ES } else { &EN }++ match chosen_language() {+ 1 => &ES,+ 3 => &FR,+ _ => &EN,+ }}+-/// The resolved language is part of the menu bar's rendered-content key.-pub fn is_spanish() -> bool {- chosen_language() == 1++/// The language the text is in, never `Auto`. Part of the menu bar's++/// rendered-content key.++pub fn language() -> Language {++ match chosen_language() {++ 1 => Language::Es,++ 3 => Language::Fr,++ _ => Language::En,++ }+ }diff --cc apps/settings/src-tauri/src/main.rsindex 8ca324e,126ac0d..b99c86e--- a/apps/settings/src-tauri/src/main.rs+++ b/apps/settings/src-tauri/src/main.rs@@@ -77,28 -65,23 +65,42 @@@ fn open_animation_settings() -> Result<launcher::open(page).map_err(|error| error.to_string())}+/// Asks for the folder the dock shows as a menu, opened at `current`;+/// `None` if the user cancels. The dialog runs on its own thread, so the+/// window keeps drawing behind it.+#[tauri::command]+async fn pick_folder(+ window: tauri::WebviewWindow,+ current: Option<String>,+) -> Result<Option<String>, String> {+ let owner = window+ .hwnd()+ .map(|hwnd| hwnd.0 as isize)+ .unwrap_or_default();+ tauri::async_runtime::spawn_blocking(move || {+ muelle_shell::folder::pick(owner, current.as_deref())+ })+ .await+ .map_err(|error| error.to_string())+}+#[tauri::command]- fn get_autostart() -> bool {- autostart::is_enabled()+ async fn get_autostart() -> Result<bool, String> {+ let dock = dock_exe().map_err(|error| error.to_string())?;+ tauri::async_runtime::spawn_blocking(move || {+ Ok(+ autostart::enabled_for(&dock.to_string_lossy()).unwrap_or_else(|error| {+ muelle_shell::log::line(&format!(+ "no se pudo consultar el inicio automático: {error}"+ ));+ // The cached choice still lets Settings open if the scheduler+ // service is unavailable. An explicit change reports its error.+ autostart::is_enabled()+ }),+ )+ })+ .await+ .map_err(|error| error.to_string())?}#[tauri::command]diff --cc apps/settings/src/i18n/fr.jsonindex 48ebce3,0000000..226019fmode 100644,000000..100644--- a/apps/settings/src/i18n/fr.json+++ b/apps/settings/src/i18n/fr.json@@@ -1,75 -1,0 +1,75 @@@+{+ "dock": "Dock",+ "system": "Système",+ "size": "Taille",+ "small": "Petite",+ "large": "Grande",+ "magnification": "Agrandissement",+ "magnificationHint": "Les icônes grossissent au passage du pointeur.",+ "magnifiedSize": "Taille agrandie",+ "autoHide": "Masquer et afficher automatiquement le Dock",- "autoHideHint": "Il réapparaît quand le pointeur touche le bord inférieur de l'écran.",++ "autoHideHint": "Laissez le pointeur sur le bord inférieur d'un écran pour y afficher le Dock.",+ "genie": "Effet génie",+ "genieHint": "Tant qu'il est activé, les fenêtres n'utilisent pas les animations de Windows pour l'agrandissement et la fermeture.",+ "genieOff": "Les animations de Windows sont désactivées",+ "genieOffHint": "L'effet génie suit le réglage « Effets d'animation » de Windows, comme toute app devrait le faire : il ne se joue donc pas. L'option « Ajuster afin d'obtenir les meilleures performances » le désactive aussi.",+ "genieOffAction": "Ouvrir les paramètres de Windows",+ "showMinimized": "Afficher les fenêtres réduites",+ "showMinimizedHint": "Sous forme de miniatures à droite du Dock, plutôt que dans l'icône de leur app.",+ "menuBar": "Barre de menus",+ "menuBarHint": "Heure, batterie et accès aux paramètres rapides et aux notifications de Windows.",+ "menuBarAutoHide": "Masquer et afficher automatiquement la barre de menus",+ "menuBarAutoHideHint": "Elle apparaît quand le pointeur s'arrête sur le bord supérieur de l'écran, jamais par-dessus les boutons de fermeture d'une fenêtre.",+ "aiUsage": "Afficher l'utilisation des fournisseurs d'IA",+ "aiUsageHint": "Lit le quota des sessions que vous avez déjà ouvertes. Interroge directement chaque fournisseur toutes les cinq minutes et n'enregistre aucun identifiant.",+ "autostart": "Ouvrir Muelle à l'ouverture de session",+ "language": "Langue",+ "languageAuto": "Automatique",+ "close": "Fermer",+ "minimize": "Réduire",+ "saveError": "Impossible d'enregistrer les réglages.",+ "checkUpdates": "Rechercher automatiquement les mises à jour",+ "checkUpdatesHint": "À son ouverture, Réglages demande à GitHub si une nouvelle version existe.",+ "autoUpdate": "Installer automatiquement les mises à jour",+ "autoUpdateHint": "Une fois par jour, quelques minutes après l'allumage de l'ordinateur (ou toutes les 24 heures s'il reste allumé), Muelle installe lui-même les nouvelles versions.",+ "updatesOff": "La recherche automatique est désactivée.",+ "updates": "Mises à jour",+ "updatesChecking": "Recherche de mises à jour…",+ "updatesCurrent": "Muelle {version} est à jour.",+ "updatesAvailable": "Muelle {version} est disponible.",+ "updatesInstalling": "Téléchargement et installation…",+ "updatesError": "Vérification impossible. Vérifiez votre connexion.",+ "updatesCheck": "Rechercher",+ "updatesInstall": "Mettre à jour",+ "showIndicators": "Afficher un indicateur sous les apps ouvertes",+ "showRecents": "Afficher les apps récentes",+ "showRecentsHint": "Les trois dernières que vous avez ouvertes sans les avoir épinglées.",+ "bounceOnOpen": "Animer l'ouverture des apps",+ "mascot": "Crabe lors des moments spéciaux",+ "mascotHint": "Un crabe en pixels apparaît quand un forfait d'IA se réinitialise ou s'épuise, quand vous branchez le chargeur ou quand l'économiseur d'énergie s'active. Passez le pointeur dessus.",+ "reset": "Rétablir les valeurs par défaut",+ "resetHint": "Retour à l'apparence et au comportement d'origine. Vos apps épinglées sont conservées.",+ "resetConfirmHint": "Cliquez à nouveau pour confirmer.",+ "resetButton": "Rétablir",+ "resetConfirm": "Confirmer",+ "updateBannerTitle": "Muelle {version} est disponible",+ "updateBannerBody": "Cette version apporte des améliorations et des corrections. Elle s'installe en quelques secondes et le Dock revient tout seul.",+ "updateNow": "Mettre à jour maintenant",+ "updateLater": "Plus tard",+ "updateRetry": "Réessayer",+ "updateWhatsNew": "Nouveautés",+ "updateDownloading": "Téléchargement… {percent} %",+ "updateDownloadingUnknown": "Téléchargement…",+ "updateInstallError": "Impossible d'installer la mise à jour. Vérifiez votre connexion et réessayez.",+ "updateBadge": "Mise à jour disponible",+ "windows": "Fenêtres",+ "menuBarShow": "Afficher la barre de menus",+ "groupBehavior": "Comportement",+ "groupMinimize": "Réduction",+ "zoom": "Agrandir",+ "updatesNow": "Cette version",+ "shortcutsFolder": "Dossier de raccourcis",+ "shortcutsFolderHint": "Un dossier à droite du Dock : son contenu s'ouvre en menu, avec un sous-menu pour chaque dossier qu'il contient.",+ "shortcutsFolderChoose": "Choisir…",+ "shortcutsFolderRemove": "Retirer"+}diff --cc crates/muelle-config/src/lib.rsindex 1bc23e7,ba27794..8fac442--- a/crates/muelle-config/src/lib.rs+++ b/crates/muelle-config/src/lib.rs@@@ -204,9 -181,52 +208,52 @@@ pub fn load(path: &Path) -> Result<Opti})}- /// Saves the configuration atomically by writing a temporary file and renaming- /// it, so an interrupted write cannot leave a truncated file.+ /// Replaces the configuration under the same lock used by incremental edits.pub fn save(path: &Path, config: &Config) -> Result<(), ConfigError> {+ let _lock = lock_for_write(path)?;+ write_config(path, config)+ }++ /// Reads, changes and publishes one version while other writers wait. Readers+ /// can still load the last complete version without acquiring the lock.+ pub fn update(+ path: &Path,+ edit: impl FnOnce(Option<Config>) -> Result<Config, ConfigError>,+ ) -> Result<Config, ConfigError> {+ let _lock = lock_for_write(path)?;+ let config = edit(load(path)?)?.sanitized();+ write_config(path, &config)?;+ Ok(config)+ }++ /// Updates only preferences explicitly changed in Settings. The roster and+ /// schema version belong to the dock and may have changed since Settings opened.+ pub fn update_preferences(+ path: &Path,+ patch: serde_json::Map<String, serde_json::Value>,+ ) -> Result<Config, ConfigError> {+ update(path, |saved| {+ let mut fields = serde_json::to_value(saved.unwrap_or_default())?;+ if let Some(fields) = fields.as_object_mut() {+ for (key, value) in patch {+ if fields.contains_key(&key)+ && !matches!(+ key.as_str(),- "version" | "pinned" | "recent" | "taskbarPins"++ "version" | "pinned" | "groups" | "recent" | "taskbarPins"+ )+ {+ fields.insert(key, value);+ }+ }+ }+ serde_json::from_value(fields).map_err(|source| ConfigError::Parse {+ path: path.to_owned(),+ source,+ })+ })+ }++ fn lock_for_write(path: &Path) -> Result<File, ConfigError> {let io_error = |source| ConfigError::Io {path: path.to_owned(),source,@@@ -245,6 -297,42 +324,67 @@@ mod testsassert_eq!(load(&path).ok(), Some(Some(config)));}+ #[test]+ fn settings_patch_keeps_dock_edits_made_since_opening() -> Result<(), ConfigError> {+ let path = scratch("settings-patch");+ let initial = Config::default();+ save(&path, &initial)?;+ update(&path, |saved| {+ let mut config = saved.unwrap_or_default();+ config.auto_hide = true;+ config.pinned.push("browser".into());+ Ok(config)+ })?;+ let patch = serde_json::Map::from_iter([+ ("iconSize".into(), 64.into()),+ ("pinned".into(), serde_json::Value::Array(Vec::new())),+ ]);+ let saved = update_preferences(&path, patch)?;+ assert!(saved.auto_hide);+ assert_eq!(saved.pinned, ["browser"]);+ assert_eq!(saved.icon_size, 64);+ Ok(())+ }+++ #[test]++ fn settings_patch_keeps_the_dock_groups() -> Result<(), ConfigError> {++ let path = scratch("settings-patch-groups");++ let group = DockGroup {++ id: "muelle:group:1".into(),++ apps: vec!["a".into(), "b".into()],++ };++ save(++ &path,++ &Config {++ pinned: vec![group.id.clone()],++ groups: vec![group.clone()],++ ..Config::default()++ },++ )?;++ let patch = serde_json::Map::from_iter([++ ("iconSize".into(), 64.into()),++ ("groups".into(), serde_json::Value::Array(Vec::new())),++ ]);++ let saved = update_preferences(&path, patch)?;++ assert_eq!(saved.groups, [group]);++ assert_eq!(saved.icon_size, 64);++ Ok(())++ }+++ #[test]+ fn a_busy_writer_keeps_the_last_complete_configuration() -> Result<(), ConfigError> {+ let path = scratch("write-contention");+ let original = Config::default();+ save(&path, &original)?;+ let _writer = lock_for_write(&path)?;+ let result = update(&path, |_| panic!("contending writer cannot edit"));+ assert!(+ matches!(result, Err(ConfigError::Io { source, .. }) if source.kind() == io::ErrorKind::WouldBlock)+ );+ assert_eq!(load(&path)?, Some(original));+ Ok(())+ }+#[test]fn load_should_fill_missing_fields_with_defaults() {let path = scratch("partial");diff --cc crates/muelle-shell/src/lib.rsindex 03dc26a,50d210c..1e66ca9--- a/crates/muelle-shell/src/lib.rs+++ b/crates/muelle-shell/src/lib.rs@@@ -2,9 -2,9 +2,10 @@@ pub mod appbarpub mod autostart;pub mod dock_link;pub mod files;+pub mod folder;pub mod icon_cache;pub mod icons;+ pub mod keyboard;pub mod launcher;pub mod log;pub mod names;