A lightweight, macOS-style dock for Windows 11, with glass visuals, smooth magnification, and Genie effect.
feat(dock): add dock settings for visibility and auto-hide options
CristianOlivera1dde5e73e9cda
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex b01e512..1102780 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,12 @@ copia la sección de la versión que se publica a la release de GitHub.### English+- Added Dock settings for Start and Recycle Bin visibility, optional File Explorer+ pinning, three spacing presets with previews, and three auto-hide animation+ speeds. Existing appearance and edge activation delays remain the defaults.+- Fixed the moon button: it toggles Muelle's Do Not Disturb without re-entering+ the app state, shows its active state, and clears queued banners while keeping+ unread badges. It does not change Windows Focus settings.- Fixed the dock appearing over full-screen playback controls (#33). Full-screendetection now follows owned controls, distinguishes custom-frame maximizedwindows, and reacts to in-place size changes without permanent polling.@@ -40,6 +46,12 @@ copia la sección de la versión que se publica a la release de GitHub.### Español+- Añadidos ajustes del Dock para ocultar Inicio y Papelera, dejar de mantener+ Explorador fijado, elegir tres espaciados con previsualización y tres velocidades+ de animación al ocultar. Se conservan el aspecto y las esperas actuales por defecto.+- Corregida la luna: activa No molestar de Muelle sin volver a pedir prestado el+ estado de la app, indica cuándo está activo y descarta banners pendientes sin+ borrar insignias. No modifica la concentración de Windows.- Corregido el dock que aparecía sobre los controles de reproducción en pantallacompleta (#33). La detección contempla controles flotantes vinculados a suventana, distingue ventanas maximizadas con marco propio y atiende cambios dediff --git a/apps/dock/src/app.rs b/apps/dock/src/app.rsindex 6b5957b..a0adb38 100644--- a/apps/dock/src/app.rs+++ b/apps/dock/src/app.rs@@ -22,7 +22,7 @@ use std::{};use anyhow::{Context, Result};-use muelle_config::{Config, DockGroup, DockPosition};+use muelle_config::{Config, DockDensity, DockGroup, DockPosition};use muelle_core::{attention::Attention,bounce,@@ -243,8 +243,6 @@ const ASSETS_DELAY_MS: u32 = 16;const DRAG_TIMER: usize = 16;const DRAG_POLL_MS: u32 = 16;-/// Auto-hide slide speed (about 250 ms).-const SLIDE_OMEGA: f32 = 24.0;/// Screen-edge strip that reveals a hidden dock, in physical pixels.const REVEAL_STRIP: i32 = 2;/// An icon released this far above the magnified dock, in icon heights, leaves it.@@ -569,6 +567,7 @@ struct StageKey {bin_full: bool,auto_hide: bool,icon_size: u32,+ density: DockDensity,max_scale: f32,indicators: bool,entries: Vec<Entry>,@@ -899,12 +898,22 @@ fn load_config() -> Config {}}-/// The Explorer is always pinned, like Finder, on its own.+/// Apply only Explorer's built-in pin, preserving the order of all other apps.+fn apply_explorer_pin(roster: &mut Roster, pinned: bool) {+ let explorer = explorer_id();+ if pinned {+ let before = roster.pinned().iter().find(|id| **id != explorer).cloned();+ roster.pin_before(&explorer, before.as_deref());+ } else {+ roster.unpin(&explorer);+ roster.forget_recent(&explorer);+ }+}+fn roster_from(config: &Config) -> Roster {let explorer = explorer_id();let mut pinned = config.pinned.clone();pinned.retain(|id| *id != explorer);- pinned.insert(0, explorer.clone());let groups = config.groups.iter()@@ -918,7 +927,9 @@ fn roster_from(config: &Config) -> Roster {.collect(),}).collect();- Roster::new(pinned, config.recent.clone()).with_groups(groups)+ let mut roster = Roster::new(pinned, config.recent.clone()).with_groups(groups);+ apply_explorer_pin(&mut roster, config.pin_explorer);+ roster}fn save_settings(roster: &Roster, config: &Config) {@@ -1042,7 +1053,9 @@ impl App {None => icon(&app.id, Role::App, app.running),}).collect();- entries.insert(0, icon(START_ID, Role::Start, false));+ if self.config.show_start {+ entries.insert(0, icon(START_ID, Role::Start, false));+ }if self.config.show_recents && !self.roster.recent().is_empty() {entries.push(separator());entries.extend(@@ -1068,7 +1081,23 @@ impl App {if let Some(downloads) = &self.downloads {entries.push(icon(downloads, Role::Folder, false));}- entries.push(icon(recycle_bin::PARSING_NAME, Role::Trash, false));+ if self.config.show_trash {+ entries.push(icon(recycle_bin::PARSING_NAME, Role::Trash, false));+ }+ // Hiding fixed items can leave a section empty. Never leave loose dividers.+ let mut previous_separator = true;+ entries.retain(|entry| {+ let separator = entry.kind == ItemKind::Separator;+ let keep = !separator || !previous_separator;+ previous_separator = separator;+ keep+ });+ while entries+ .last()+ .is_some_and(|entry| entry.kind == ItemKind::Separator)+ {+ entries.pop();+ }entries}@@ -1278,6 +1307,7 @@ impl App {bin_full: self.bin_full,auto_hide: self.config.auto_hide,icon_size: self.config.icon_size,+ density: self.config.dock_density,max_scale: self.config.max_scale(),indicators: self.config.show_indicators,entries: self.current_entries(),@@ -1298,8 +1328,11 @@ impl App {let scale = monitor.scale;let max_scale = key.max_scale;+ let (gap, padding) = key.density.spacing();let mut metrics = Metrics {icon: key.icon_size as f32,+ gap,+ padding,..Metrics::DEFAULT}.scaled(scale);@@ -2647,8 +2680,8 @@ impl App {self.place_windows()}- /// Only running or pinned apps, and groups, can be dragged; the Explorer,- /// Start, recent apps, Downloads, and the recycle bin stay in place.+ /// Only running or pinned apps, and groups, can be dragged. Explorer's+ /// built-in pin is managed by Settings; the other fixed items stay put too.fn is_draggable(&self, entry: &Entry) -> bool {matches!(entry.role, Role::App | Role::Group)&& entry.id.as_ref().is_some_and(|id| {@@ -3835,11 +3868,17 @@ impl App {self.restore_transitions();self.snapshots.clear();}+ if config.notification_dnd || !config.notifications {+ self.notifications.clear_banners();+ notification_banner::NotificationBannerView::hide();+ }if config.auto_hide != self.config.auto_hide {self.slide.target = if config.auto_hide { 1.0 } else { 0.0 };self.last_frame = Instant::now();}let moved = config.dock_position != self.config.dock_position;+ apply_explorer_pin(&mut self.roster, config.pin_explorer);+ self.slide.omega = config.dock_auto_hide_speed.omega();self.config = config;if moved {// A hidden dock comes out of its new edge on every display.@@ -3899,6 +3938,7 @@ impl App {for id in previous.iter().filter(|id| !current.contains(id)) {self.roster.unpin(id);}+ apply_explorer_pin(&mut self.roster, self.config.pin_explorer);save_settings(&self.roster, &self.config);self.refresh()}@@ -4107,18 +4147,20 @@ impl App {}}- pub fn toggle_dnd(&mut self) {- self.config.notification_dnd = !self.config.notification_dnd;- if self.config.notification_dnd {+ fn toggle_dnd(&mut self) -> Result<()> {+ let enabled = !self.config.notification_dnd;+ let mut patch = serde_json::Map::new();+ patch.insert("notificationDnd".into(), serde_json::Value::Bool(enabled));+ muelle_config::update_preferences(&muelle_config::default_path(), patch)?;+ self.config.notification_dnd = enabled;+ if enabled {+ self.notifications.clear_banners();notification_banner::NotificationBannerView::hide();}- let mut patch = serde_json::Map::new();- patch.insert(- "notificationDnd".into(),- serde_json::Value::Bool(self.config.notification_dnd),- );- let _ = muelle_config::update_preferences(&muelle_config::default_path(), patch);- menu_bar_refresh();+ if let Some(bar) = &mut self.menubar {+ bar.set_dnd(&self.gfx, enabled)?;+ }+ Ok(())}fn sync_attention_visuals(&mut self) -> Result<()> {@@ -4183,6 +4225,9 @@ impl App {let changed = self.roster.sync(self.windows.iter().map(|window| window.app_id.as_str()));+ if !self.config.pin_explorer {+ self.roster.forget_recent(&explorer_id());+ }if self.roster.recent() != recent_before.as_slice() {save_settings(&self.roster, &self.config);}@@ -4354,6 +4399,7 @@ impl App {bluetooth: self.config.menu_bar_bluetooth,battery_percent: self.config.menu_bar_battery_percent,island_style: self.config.menu_bar_island_style,+ dnd: self.config.notification_dnd,};if !self.config.menu_bar {self.menubar = None;@@ -4537,7 +4583,7 @@ impl App {y: screen.top + (screen.bottom - screen.top) / 2,});self.amount = Spring::at(0.0, HOVER_OMEGA);- self.slide = Spring::at(1.0, SLIDE_OMEGA);+ self.slide = Spring::at(1.0, self.config.dock_auto_hide_speed.omega());self.fullscreen = false;self.refresh()?;}@@ -4819,6 +4865,11 @@ fn with_app_value<T: Default>(what: &str, action: impl FnOnce(&mut App) -> Resulpub fn menu_bar_clicked(x: f32, y: f32) {with_app_then("barra superior", |app| {if let Some(bar) = &mut app.menubar {+ if bar.dnd_at(x, y) {+ bar.dismiss_island(&app.gfx)?;+ app.toggle_dnd()?;+ return Ok(None);+ }if let Some(anchor) = bar.input_switcher_anchor(x, y) {bar.dismiss_island(&app.gfx)?;return Ok(Some(Outside::InputMenu {@@ -5653,6 +5704,7 @@ pub fn run() -> Result<()> {strings::set_language(config.language);let roster = roster_from(&config);let auto_hide = config.auto_hide;+ let slide_omega = config.dock_auto_hide_speed.omega();let mut app = App {visual,input,@@ -5683,7 +5735,7 @@ pub fn run() -> Result<()> {placeholder: None,remove_label: None,config,- slide: Spring::at(if auto_hide { 1.0 } else { 0.0 }, SLIDE_OMEGA),+ slide: Spring::at(if auto_hide { 1.0 } else { 0.0 }, slide_omega),press: None,drag: None,incoming: Vec::new(),@@ -5857,6 +5909,72 @@ pub fn run() -> Result<()> {Ok(())}+#[cfg(test)]+mod dock_preferences_tests {+ use super::*;++ #[test]+ fn explorer_preference_preserves_other_pins_and_follows_open_windows() {+ let explorer = explorer_id();+ let config = Config {+ pinned: vec!["editor".into(), explorer.clone(), "browser".into()],+ pin_explorer: false,+ ..Config::default()+ };+ let mut roster = roster_from(&config);+ assert_eq!(roster.pinned(), ["editor", "browser"]);+ assert!(!roster.apps().iter().any(|app| app.id == explorer));+ roster.sync(["editor", explorer.as_str()]);+ assert!(roster.is_running(&explorer) && !roster.is_pinned(&explorer));+ apply_explorer_pin(&mut roster, true);+ assert_eq!(roster.pinned(), [explorer.as_str(), "editor", "browser"]);+ apply_explorer_pin(&mut roster, false);+ assert!(roster.is_running(&explorer) && !roster.is_pinned(&explorer));+ roster.sync(["editor"]);+ apply_explorer_pin(&mut roster, false);+ assert!(!roster.apps().iter().any(|app| app.id == explorer));+ assert!(!roster.recent().contains(&explorer));+ }++ #[test]+ fn density_changes_dimensions_without_changing_icon_size() {+ let mut widths = Vec::new();+ for density in [+ DockDensity::Compact,+ DockDensity::Normal,+ DockDensity::Spacious,+ ] {+ let (gap, padding) = density.spacing();+ let metrics = Metrics {+ icon: 64.0,+ gap,+ padding,+ ..Metrics::DEFAULT+ };+ let result = layout(&[ItemKind::Icon; 3], &metrics);+ assert!(result.slots.iter().all(|slot| slot.rect.width == 64.0));+ widths.push(result.width);+ }+ assert!(widths.windows(2).all(|pair| pair[0] < pair[1]));+ }++ #[test]+ fn auto_hide_presets_keep_the_original_speed_as_default() {+ use muelle_config::DockAutoHideSpeed;+ let progress = |speed: DockAutoHideSpeed| {+ let mut spring = Spring::at(1.0, speed.omega());+ spring.target = 0.0;+ for _ in 0..12 {+ spring.step(1.0 / 120.0);+ }+ spring.value+ };+ assert!(progress(DockAutoHideSpeed::Smooth) > progress(DockAutoHideSpeed::Normal));+ assert!(progress(DockAutoHideSpeed::Normal) > progress(DockAutoHideSpeed::Fast));+ assert_eq!(DockAutoHideSpeed::default().omega(), 24.0);+ }+}+#[cfg(test)]mod attention_tests {use super::*;diff --git a/apps/dock/src/menubar.rs b/apps/dock/src/menubar.rsindex 419a093..1ec224b 100644--- a/apps/dock/src/menubar.rs+++ b/apps/dock/src/menubar.rs@@ -185,6 +185,7 @@ pub struct MenuBarWidgets {pub bluetooth: bool,pub battery_percent: Option<bool>,pub island_style: IslandStyle,+ pub dnd: bool,}impl Default for MenuBarWidgets {@@ -196,6 +197,7 @@ impl Default for MenuBarWidgets {bluetooth: true,battery_percent: None,island_style: IslandStyle::Notch,+ dnd: false,}}}@@ -254,7 +256,7 @@ fn accessory_readings(snapshot: &AccessorySnapshot) -> [Option<AccessoryReading>impl Look {fn panel_content_height(&self) -> f32 {match self.panel {- Some(Island::Music) => 184.0,+ Some(Island::Music) => 164.0,Some(Island::Usage) => {74.0 + Provider::ALL.into_iter()@@ -1729,12 +1731,7 @@ impl MenuBar {Some(Action::AccessoryIndicator) => {}Some(Action::QuickSettings) => launcher::open_quick_settings(),Some(Action::Notifications) => launcher::open_notifications(),- Some(Action::ToggleDnd) => {- crate::app::with_app("toggle dnd", |app| {- app.toggle_dnd();- Ok(())- });- }+ Some(Action::ToggleDnd) => {} // Dispatched by App without borrowing it again.Some(Action::Sound) => launcher::open_sound(),Some(Action::Search) => launcher::open_search(),Some(Action::TaskView) => launcher::open_task_view(),@@ -1754,6 +1751,22 @@ impl MenuBar {Ok(())}+ pub fn dnd_at(&self, x: f32, y: f32) -> bool {+ y >= 0.0+ && y < (self.bounds.bottom - self.bounds.top) as f32+ && self.zones.iter().any(|(left, right, action)| {+ x >= *left && x < *right && *action == Action::ToggleDnd+ })+ }++ pub fn set_dnd(&mut self, gfx: &Gfx, enabled: bool) -> Result<()> {+ let widgets = MenuBarWidgets {+ dnd: enabled,+ ..self.widgets+ };+ self.set_widgets(gfx, widgets)+ }+pub fn input_switcher_anchor(&self, x: f32, y: f32) -> Option<POINT> {if y < 0.0 || y >= (self.bounds.bottom - self.bounds.top) as f32 {return None;@@ -2075,6 +2088,23 @@ impl MenuBar {right -= px(6.0);}let left = right - item.width;+ if *action == Action::ToggleDnd && look.widgets.dnd {+ add_rounded_box(+ c,+ &layers,+ left - px(5.0),+ px(4.0),+ item.width + px(10.0),+ height - px(8.0),+ px(6.0),+ if look.light {+ rgba(0, 0, 0, 28)+ } else {+ rgba(255, 255, 255, 48)+ },+ None,+ )?;+ }place(&layers, item, left)?;// The battery icon and its percentage form one control.// Accessory readings are passive status indicators, not controls.@@ -2635,18 +2665,6 @@ impl MenuBar {.push(geometry.hit(x, y, size, size, IslandAction::Media(control)));}}- add_panel_text(- gfx,- layers,- strings::text().media_volume,- px(25.0),- px(135.0),- geometry.scale,- 10.5,- false,- ink,- 0.65,- )?;if let Some(volume) = self.status.volume {let symbol = if volume.muted {glyph::MUTE@@ -2659,7 +2677,7 @@ impl MenuBar {layers,&label.brush.cast()?,px(25.0),- px(160.0) - label.height / 2.0,+ px(140.0) - label.height / 2.0,label.width,label.height,)?;@@ -2677,7 +2695,7 @@ impl MenuBar {c,layers,left,- px(158.0),+ px(138.0),width,px(4.0),px(2.0),@@ -2688,7 +2706,7 @@ impl MenuBar {c,layers,left,- px(158.0),+ px(138.0),width,px(4.0),px(2.0),@@ -2704,7 +2722,7 @@ impl MenuBar {c,layers,left - dot / 2.0,- px(160.0) - dot / 2.0,+ px(140.0) - dot / 2.0,dot,dot,dot / 2.0,@@ -2718,7 +2736,7 @@ impl MenuBar {layers,&label.brush.cast()?,geometry.width - px(51.0),- px(153.0),+ px(133.0),label.width,label.height,)?;@@ -2737,7 +2755,7 @@ impl MenuBar {self.volume_controls = Some(controls);self.island_hits.push(geometry.hit(left - px(6.0),- px(147.0),+ px(127.0),width + px(12.0),px(29.0),IslandAction::Volume(Span {@@ -2751,7 +2769,7 @@ impl MenuBar {layers,strings::text().media_no_output,px(25.0),- px(155.0),+ px(135.0),geometry.scale,11.0,false,@@ -3718,6 +3736,41 @@ impl Drop for MenuBar {mod island_tests {use super::*;+ #[test]+ #[ignore = "Requires Windows composition; hidden bar, no config or audio writes"]+ fn native_dnd_hit_and_presentation_follow_the_saved_state() -> Result<()> {+ use anyhow::Context;+ use windows::Win32::System::WinRT::{+ CreateDispatcherQueueController, DQTAT_COM_STA, DQTYPE_THREAD_CURRENT,+ DispatcherQueueOptions,+ };+ let _queue = unsafe {+ CreateDispatcherQueueController(DispatcherQueueOptions {+ dwSize: size_of::<DispatcherQueueOptions>() as u32,+ threadType: DQTYPE_THREAD_CURRENT,+ apartmentType: DQTAT_COM_STA,+ })?+ };+ let gfx = Gfx::new()?;+ let mut bar = MenuBar::create(&gfx, false, false, true, MenuBarWidgets::default())?;+ bar.set_visible(false)?;+ for enabled in [false, true, false] {+ bar.set_dnd(&gfx, enabled)?;+ assert_eq!(bar.look.as_ref().context("bar look")?.widgets.dnd, enabled);+ let (left, right, _) = *bar+ .zones+ .iter()+ .find(|(_, _, action)| *action == Action::ToggleDnd)+ .context("focus button")?;+ let x = (left + right) * 0.5;+ let height = (bar.bounds.bottom - bar.bounds.top) as f32;+ assert!(bar.dnd_at(x, height * 0.5));+ assert!(!bar.dnd_at(x, -1.0));+ assert!(!bar.dnd_at(x, height + 1.0));+ }+ Ok(())+ }+#[test]#[ignore = "Native popup layout/input regression; hidden window, no audio writes"]fn native_popup_overflow_and_layout_changes_keep_input_in_sync() -> Result<()> {diff --git a/apps/dock/src/strings.rs b/apps/dock/src/strings.rsindex b8fb3af..19a5610 100644--- a/apps/dock/src/strings.rs+++ b/apps/dock/src/strings.rs@@ -39,7 +39,6 @@ pub struct Strings {pub usage_updated: &'static str,pub usage_used: &'static str,pub media_title: &'static str,- pub media_volume: &'static str,pub media_no_output: &'static str,pub folder_empty: &'static str,pub folder_unavailable: &'static str,@@ -85,7 +84,6 @@ const ES: Strings = Strings {usage_updated: "Actualizado hace",usage_used: "usado",media_title: "Reproducción",- media_volume: "Volumen del sistema",media_no_output: "Sin dispositivo de salida",folder_empty: "(vacía)",folder_unavailable: "Carpeta no disponible",@@ -128,7 +126,6 @@ const EN: Strings = Strings {usage_updated: "Updated",usage_used: "used",media_title: "Now playing",- media_volume: "System volume",media_no_output: "No output device",folder_empty: "(empty)",folder_unavailable: "Folder unavailable",@@ -171,7 +168,6 @@ const FR: Strings = Strings {usage_updated: "Actualisé il y a",usage_used: "utilisé",media_title: "En cours de lecture",- media_volume: "Volume du système",media_no_output: "Aucun périphérique de sortie",folder_empty: "(vide)",folder_unavailable: "Dossier introuvable",diff --git a/apps/settings/src/App.tsx b/apps/settings/src/App.tsxindex 8962e90..c9279c6 100644--- a/apps/settings/src/App.tsx+++ b/apps/settings/src/App.tsx@@ -5,6 +5,8 @@ import { useCallback, useEffect, useRef, useState } from "react";import {type Config,type DockPosition,+ type DockDensity,+ type DockAutoHideSpeed,type GenieSpeed,type IslandStyle,type Language,@@ -345,6 +347,16 @@ export function App() {onChange={(iconSize) => update({ iconSize })}/></Row>+ <VisualChoices<DockDensity>+ label={t.dockDensity}+ value={config.dockDensity ?? "normal"}+ options={[+ { value: "compact", label: t.dockDensityCompact, preview: <DockPreview position="bottom" iconSize={48} density="compact" wallpaper={wallpaper} /> },+ { value: "normal", label: t.dockDensityNormal, preview: <DockPreview position="bottom" iconSize={48} density="normal" wallpaper={wallpaper} /> },+ { value: "spacious", label: t.dockDensitySpacious, preview: <DockPreview position="bottom" iconSize={48} density="spacious" wallpaper={wallpaper} /> },+ ]}+ onChange={(dockDensity) => update({ dockDensity })}+ /><Row icon={<SettingIcon name="magnification" />} label={t.magnification} hint={t.magnificationHint}><Togglelabel={t.magnification}@@ -362,6 +374,17 @@ export function App() {/></SubRow></Card>+ <Card title={t.dockItems}>+ <Row label={t.showStart}>+ <Toggle label={t.showStart} checked={config.showStart ?? true} onChange={(showStart) => update({ showStart })} />+ </Row>+ <Row label={t.pinExplorer} hint={t.pinExplorerHint}>+ <Toggle label={t.pinExplorer} checked={config.pinExplorer ?? true} onChange={(pinExplorer) => update({ pinExplorer })} />+ </Row>+ <Row label={t.showTrash}>+ <Toggle label={t.showTrash} checked={config.showTrash ?? true} onChange={(showTrash) => update({ showTrash })} />+ </Row>+ </Card><Card title={t.groupBehavior}><Row icon={<SettingIcon name="hide" />} label={t.autoHide} hint={t.autoHideHint}><Toggle@@ -370,6 +393,18 @@ export function App() {onChange={(autoHide) => update({ autoHide })}/></Row>+ <SubRow label={t.dockAutoHideSpeed} open={config.autoHide}>+ <Segmented<DockAutoHideSpeed>+ label={t.dockAutoHideSpeed}+ value={config.dockAutoHideSpeed ?? "normal"}+ options={[+ { value: "smooth", label: t.dockAutoHideSmooth },+ { value: "normal", label: t.dockDensityNormal },+ { value: "fast", label: t.genieSpeedFast },+ ]}+ onChange={(dockAutoHideSpeed) => update({ dockAutoHideSpeed })}+ />+ </SubRow><Row icon={<SettingIcon name="bounce" />} label={t.bounceOnOpen}><Togglelabel={t.bounceOnOpen}diff --git a/apps/settings/src/config.ts b/apps/settings/src/config.tsindex 186b04d..2424d25 100644--- a/apps/settings/src/config.ts+++ b/apps/settings/src/config.ts@@ -5,6 +5,8 @@ export type NotificationPosition = "top-right" | "bottom-right";export type IslandStyle = "notch" | "bubble";export type GenieSpeed = "normal" | "fast" | "faster";export type DockPosition = "left" | "bottom" | "right";+export type DockDensity = "compact" | "normal" | "spacious";+export type DockAutoHideSpeed = "smooth" | "normal" | "fast";/** Mirrors `muelle_config::Config`. */export interface Config {@@ -16,6 +18,11 @@ export interface Config {magnification: boolean;magnifiedSize: number;dockPosition: DockPosition;+ dockDensity: DockDensity;+ dockAutoHideSpeed: DockAutoHideSpeed;+ showStart: boolean;+ showTrash: boolean;+ pinExplorer: boolean;genie: boolean;genieSpeed: GenieSpeed;showMinimized: boolean;diff --git a/apps/settings/src/i18n/en.json b/apps/settings/src/i18n/en.jsonindex d1ff5ee..6f32ffb 100644--- a/apps/settings/src/i18n/en.json+++ b/apps/settings/src/i18n/en.json@@ -1,5 +1,16 @@{"dock": "Dock",+ "dockDensity": "Spacing",+ "dockDensityCompact": "Compact",+ "dockDensityNormal": "Normal",+ "dockDensitySpacious": "Spacious",+ "dockItems": "Fixed items",+ "showStart": "Show Start",+ "showTrash": "Show Recycle Bin",+ "pinExplorer": "Keep File Explorer in the Dock",+ "pinExplorerHint": "When off, it appears only while its windows are open.",+ "dockAutoHideSpeed": "Animation speed",+ "dockAutoHideSmooth": "Smooth","system": "System","size": "Size","small": "Small",diff --git a/apps/settings/src/i18n/es.json b/apps/settings/src/i18n/es.jsonindex dc52e58..c648493 100644--- a/apps/settings/src/i18n/es.json+++ b/apps/settings/src/i18n/es.json@@ -1,5 +1,16 @@{"dock": "Dock",+ "dockDensity": "Espaciado",+ "dockDensityCompact": "Compacto",+ "dockDensityNormal": "Normal",+ "dockDensitySpacious": "Amplio",+ "dockItems": "Elementos fijos",+ "showStart": "Mostrar Inicio",+ "showTrash": "Mostrar la Papelera",+ "pinExplorer": "Mantener Explorador en el Dock",+ "pinExplorerHint": "Desactivado, aparece solo mientras tiene ventanas abiertas.",+ "dockAutoHideSpeed": "Velocidad de la animación",+ "dockAutoHideSmooth": "Suave","system": "Sistema","size": "Tamaño","small": "Pequeño",diff --git a/apps/settings/src/i18n/fr.json b/apps/settings/src/i18n/fr.jsonindex 1835725..0e0fdef 100644--- a/apps/settings/src/i18n/fr.json+++ b/apps/settings/src/i18n/fr.json@@ -1,5 +1,16 @@{"dock": "Dock",+ "dockDensity": "Espacement",+ "dockDensityCompact": "Compact",+ "dockDensityNormal": "Normal",+ "dockDensitySpacious": "Aéré",+ "dockItems": "Éléments fixes",+ "showStart": "Afficher Démarrer",+ "showTrash": "Afficher la Corbeille",+ "pinExplorer": "Garder l’Explorateur dans le Dock",+ "pinExplorerHint": "Désactivé, il apparaît uniquement lorsque ses fenêtres sont ouvertes.",+ "dockAutoHideSpeed": "Vitesse de l’animation",+ "dockAutoHideSmooth": "Douce","system": "Système","size": "Taille","small": "Petite",diff --git a/apps/settings/src/styles.css b/apps/settings/src/styles.cssindex b63a0ea..594e4e2 100644--- a/apps/settings/src/styles.css+++ b/apps/settings/src/styles.css@@ -492,6 +492,8 @@ input:focus-visible {.preview-window { position: absolute; left: 28%; top: 24%; width: 48%; height: 43%; border-radius: 3px; background: var(--content); box-shadow: 0 2px 5px #0001; padding: 4px; display: flex; gap: 2px; align-items: start; }.preview-window i { width: 2px; height: 2px; border-radius: 50%; background: var(--text-dim); opacity: .6; }.preview-dock { position: absolute; display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 5px; background: var(--sidebar); box-shadow: 0 1px 3px #0002; }+.preview-dock[data-density="compact"] { gap: 1px; padding: 2px; }+.preview-dock[data-density="spacious"] { gap: 4px; padding: 5px; }.preview-dock[data-position="bottom"] { bottom: 4px; left: 50%; transform: translateX(-50%); }.preview-dock[data-position="left"] { left: 4px; top: 50%; transform: translateY(-50%); flex-direction: column; }.preview-dock[data-position="right"] { right: 4px; top: 50%; transform: translateY(-50%); flex-direction: column; }diff --git a/apps/settings/src/visuals.tsx b/apps/settings/src/visuals.tsxindex 5e107e9..ba04b8c 100644--- a/apps/settings/src/visuals.tsx+++ b/apps/settings/src/visuals.tsx@@ -1,5 +1,5 @@import type { CSSProperties, ReactNode } from "react";-import type { DockPosition, GenieSpeed, IslandStyle } from "./config";+import type { DockDensity, DockPosition, GenieSpeed, IslandStyle } from "./config";const PATHS = {size: <><rect x="3" y="9" width="6" height="6" rx="1.5" /><rect x="13" y="5" width="9" height="14" rx="2" /></>,@@ -35,12 +35,12 @@ export function SettingIcon({ name, size = 18 }: { name: keyof typeof PATHS; sizconst MINI_ICONS = <><i /><i /><i /><i /><i /></>;/** Illustrations only: no window capture, network, timers or animation loop. */-export function DockPreview({ position, iconSize, wallpaper }: { position: DockPosition; iconSize: number; wallpaper: string | null }) {+export function DockPreview({ position, iconSize, wallpaper, density = "normal" }: { position: DockPosition; iconSize: number; wallpaper: string | null; density?: DockDensity }) {return <span className="preview-screen">{wallpaper ? <img className="preview-wallpaper" src={wallpaper} alt="" /> : null}<span className="preview-topbar"><i /><i /><i /></span><span className="preview-window"><i /><i /><i /></span>- <span className="preview-dock" data-position={position}+ <span className="preview-dock" data-position={position} data-density={density}style={{ "--mini-icon": `${6 + (iconSize - 32) / 16}px` } as CSSProperties}>{MINI_ICONS}</span></span>;}diff --git a/apps/settings/tests/app.test.mjs b/apps/settings/tests/app.test.mjsindex 2f7f36f..e20068a 100644--- a/apps/settings/tests/app.test.mjs+++ b/apps/settings/tests/app.test.mjs@@ -28,6 +28,8 @@ const base = {language: "en", menuBar: true, notifications: true, notificationDuration: 5,notificationPosition: "top-right", iconSize: 48, magnifiedSize: 77,magnification: true, dockPosition: "bottom", genie: true, genieSpeed: "normal",+ dockDensity: "normal", dockAutoHideSpeed: "normal", showStart: true,+ showTrash: true, pinExplorer: true,menuBarIslandStyle: "notch", menuBarSearch: null, menuBarTaskView: null,menuBarWidgets: null, menuBarBatteryPercent: null, checkUpdates: false,pinned: [], recent: [], mutedApps: [], shortcutsFolder: null,@@ -173,3 +175,27 @@ test("confirming reset cancels its old confirmation timer", async () => {assert.equal([...view.timers.values()].filter((timer) => timer.delay === 4000).length, 1);} finally { unmount(); }});++test("dock choices save only the selected preferences and preserve icon size", async () => {+ const view = fixture("dock", { autoHide: true, iconSize: 64 });+ const unmount = await view.mount();+ try {+ view.change(texts.en.showStart, false);+ view.change(texts.en.pinExplorer, false);+ view.change(texts.en.showTrash, false);+ view.change(texts.en.dockDensity, "compact");+ view.change(texts.en.dockAutoHideSpeed, "fast");+ view.fire(60);+ await settle();+ assert.deepEqual(view.calls, [{ showStart: false, pinExplorer: false, showTrash: false,+ dockDensity: "compact", dockAutoHideSpeed: "fast" }]);+ const controls = [...elements(view.body())];+ for (const label of [texts.en.showStart, texts.en.pinExplorer, texts.en.showTrash]) {+ assert.equal(controls.find((node) => node.props.label === label && "checked" in node.props).props.checked, false);+ }+ assert.equal(controls.find((node) => node.props.label === texts.en.size && "value" in node.props).props.value, 64);+ const html = renderToStaticMarkup(view.body());+ assert.ok(html.includes('checked="" value="compact"'));+ assert.ok(html.includes('checked="" value="fast"'));+ } finally { unmount(); }+});diff --git a/crates/muelle-config/src/lib.rs b/crates/muelle-config/src/lib.rsindex 0e41dcc..7a937d2 100644--- a/crates/muelle-config/src/lib.rs+++ b/crates/muelle-config/src/lib.rs@@ -59,6 +59,12 @@ pub struct Config {/// The screen edge the dock sits on. Bottom by default, as on macOS;/// never the top, which belongs to the menu bar.pub dock_position: DockPosition,+ pub dock_density: DockDensity,+ pub dock_auto_hide_speed: DockAutoHideSpeed,+ pub show_start: bool,+ pub show_trash: bool,+ /// Keep Explorer pinned; otherwise it appears only while its windows are open.+ pub pin_explorer: bool,/// Genie effect when minimizing. On by default; while enabled, the dock/// turns off the system's own window transitions (see plan, "Efecto genio").pub genie: bool,@@ -173,6 +179,50 @@ pub enum GenieSpeed {Normal,}+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]+#[serde(rename_all = "lowercase")]+pub enum DockDensity {+ Compact,+ Spacious,+ #[default]+ #[serde(other)]+ Normal,+}++impl DockDensity {+ /// Icon spacing and inner padding, in logical pixels, independent of icon size.+ #[must_use]+ pub const fn spacing(self) -> (f32, f32) {+ match self {+ Self::Compact => (8.0, 6.0),+ Self::Normal => (12.0, 9.0),+ Self::Spacious => (16.0, 12.0),+ }+ }+}++#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]+#[serde(rename_all = "lowercase")]+pub enum DockAutoHideSpeed {+ Smooth,+ Fast,+ #[default]+ #[serde(other)]+ Normal,+}++impl DockAutoHideSpeed {+ /// Frequency of the existing critically damped slide spring; dwell is unchanged.+ #[must_use]+ pub const fn omega(self) -> f32 {+ match self {+ Self::Smooth => 16.0,+ Self::Normal => 24.0,+ Self::Fast => 36.0,+ }+ }+}+impl GenieSpeed {/// How long one genie flight lasts, minimizing or restoring.#[must_use]@@ -252,6 +302,11 @@ impl Default for Config {icon_size: 48,magnification: true,dock_position: DockPosition::Bottom,+ dock_density: DockDensity::Normal,+ dock_auto_hide_speed: DockAutoHideSpeed::Normal,+ show_start: true,+ show_trash: true,+ pin_explorer: true,magnified_size: 77,genie: true,genie_speed: GenieSpeed::Normal,@@ -417,6 +472,38 @@ fn write_config(path: &Path, config: &Config) -> Result<(), ConfigError> {mod tests {use super::*;+ #[test]+ fn older_configs_keep_the_original_dock_defaults() -> Result<(), serde_json::Error> {+ let config: Config = serde_json::from_str(r#"{"iconSize":64}"#)?;+ assert!(config.show_start && config.show_trash && config.pin_explorer);+ assert_eq!(config.dock_density.spacing(), (12.0, 9.0));+ assert_eq!(config.dock_auto_hide_speed.omega(), 24.0);+ Ok(())+ }++ #[test]+ fn dock_preferences_round_trip_and_unknown_presets_fall_back() -> Result<(), serde_json::Error>+ {+ let config: Config = serde_json::from_str(+ r#"{+ "showStart":false,"showTrash":false,"pinExplorer":false,+ "dockDensity":"compact","dockAutoHideSpeed":"fast"+ }"#,+ )?;+ assert!(!config.show_start && !config.show_trash && !config.pin_explorer);+ assert_eq!(config.dock_density.spacing(), (8.0, 6.0));+ assert_eq!(config.dock_auto_hide_speed.omega(), 36.0);+ assert_eq!(+ serde_json::from_str::<Config>(&serde_json::to_string(&config)?)?,+ config+ );+ let unknown: Config =+ serde_json::from_str(r#"{"dockDensity":"future","dockAutoHideSpeed":"future"}"#)?;+ assert_eq!(unknown.dock_density, DockDensity::Normal);+ assert_eq!(unknown.dock_auto_hide_speed, DockAutoHideSpeed::Normal);+ Ok(())+ }+fn scratch(name: &str) -> PathBuf {let folder = env::temp_dir().join(format!("muelle-test-{}-{name}", std::process::id()));let _ = fs::remove_dir_all(&folder);diff --git a/crates/muelle-core/src/notifications.rs b/crates/muelle-core/src/notifications.rsindex 5e98c06..2af9881 100644--- a/crates/muelle-core/src/notifications.rs+++ b/crates/muelle-core/src/notifications.rs@@ -196,10 +196,15 @@ impl NotificationQueue {self.items.len()}- /// Clears all notifications and badges.- pub fn clear_all(&mut self) {+ /// Removes banners when Do Not Disturb is enabled, preserving unread badges.+ pub fn clear_banners(&mut self) {self.items.clear();self.hovered_id = None;+ }++ /// Clears all notifications and badges.+ pub fn clear_all(&mut self) {+ self.clear_banners();self.badges.clear();}}@@ -249,6 +254,39 @@ pub fn banner_close_button_bounds(banner_rect: Rect, scale: f32) -> Rect {mod tests {use super::*;+ #[test]+ fn enabling_dnd_drops_old_banners_but_preserves_unread_badges() {+ let mut queue = NotificationQueue::default();+ queue.push(+ "app".into(),+ "App".into(),+ "Title".into(),+ "Body".into(),+ None,+ None,+ 5000,+ false,+ false,+ );+ queue.clear_banners();+ assert!(queue.visible_items().is_empty());+ assert_eq!(queue.badge_count("app"), 1);+ queue.push(+ "app".into(),+ "App".into(),+ "Silent".into(),+ "Body".into(),+ None,+ None,+ 5000,+ true,+ false,+ );+ assert!(queue.tick(6000).is_empty());+ assert!(queue.visible_items().is_empty());+ assert_eq!(queue.badge_count("app"), 2);+ }+#[test]fn test_push_and_expiration() {let mut queue = NotificationQueue::new();