A lightweight, macOS-style dock for Windows 11, with glass visuals, smooth magnification, and Genie effect.
feat: add appearance settings and theme options
CristianOlivera10596a25d36d7
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex bfe4f5a..9897e62 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,11 +10,23 @@ copia la sección de la versión que se publica a la release de GitHub.### English-- Fixed Dock hiding-policy transitions and pending input: automatic hiding takes- precedence over intelligent hiding, which is visibly paused in Settings without- discarding its saved choice. Returning to a visible mode clears stale hiding;- menus and held clicks keep the Dock open, with the existing hide delay resumed- after release/cancellation. Overlap checks are skipped in automatic mode.+- Fixed the "Show hidden icons" tooltip appearing over the desktop after closing+ a full-screen app or the last window (issue #48). Windows gave the focus to+ the hidden taskbar; the dock now hands it to the window in front, or to the+ desktop. The menu bar's hidden-icons button keeps working.+- Window previews always have their close button, and icons always bounce when+ an app asks for attention: both Settings switches were removed and their+ saved values are ignored.+- New Appearance section in Settings (issue #50): the dock, the menu bar and+ their menus and panels follow Windows by default (Automatic) or take one of+ five themes: Light, Dark, Frosted glass, Clear and Aurora, each previewed over+ your own wallpaper. Glass themes fall back to solid while Windows transparency+ is off. Settings follows the chosen theme too. No new timers or polling.+- Dock visibility now uses one dropdown: Always visible, Automatic or+ Intelligent. New installs and Reset use Intelligent; existing choices are+ preserved. Fixed policy transitions and pending input; menus and held clicks+ keep the Dock open, and release/cancellation resumes the existing hide delay.+ The context-menu toggle also keeps the selected policies mutually exclusive.- Internal: split the dock coordinator into private modules by responsibility,keeping its shared state, event entry points, timers and behavior unchanged.- Battery percentage, Search, Task View and Widgets now follow Windows settings@@ -38,11 +50,26 @@ copia la sección de la versión que se publica a la release de GitHub.### Español-- Corregidas las transiciones de ocultación y pulsaciones pendientes del Dock:- la automática tiene prioridad y la inteligente queda en pausa en Ajustes,- conservando su preferencia. Volver a un modo visible limpia ocultaciones- anteriores; menús y pulsaciones mantienen el Dock abierto y al terminar se- retoma el retraso existente. Sin consultas de solapamiento en modo automático.+- Corregido el globo «Mostrar iconos ocultos» que aparecía sobre el escritorio+ al cerrar una app a pantalla completa o la última ventana (issue #48). Windows+ daba el foco a la barra de tareas oculta; ahora el dock lo pasa a la ventana+ del frente o al escritorio. El botón de iconos ocultos de la barra superior+ sigue funcionando.+- Las previsualizaciones de ventanas siempre tienen su botón de cerrar y los+ iconos siempre rebotan cuando una app pide atención: se quitaron ambos+ interruptores de Ajustes y se ignoran sus valores guardados.+- Nueva sección Apariencia en Ajustes (issue #50): el dock, la barra superior y+ sus menús y paneles siguen a Windows por defecto (Automático) o usan uno de+ cinco temas: Claro, Oscuro, Cristal esmerilado, Transparente y Aurora, cada uno+ con su vista previa sobre tu propio fondo de pantalla. Los temas de cristal se+ ven sólidos mientras Windows tenga la transparencia desactivada. Ajustes+ también sigue el tema elegido. Sin temporizadores ni sondeos nuevos.+- Visibilidad del Dock en un único desplegable: Siempre visible, Automática+ o Inteligente. Las instalaciones nuevas y Restablecer usan Inteligente;+ se conservan las elecciones anteriores. Corregidas las transiciones y+ pulsaciones pendientes; menús y pulsaciones mantienen el Dock abierto y al+ terminar se retoma el retraso existente. El menú contextual también evita+ activar ambas políticas a la vez.- Interno: separado el coordinador del dock en módulos privados porresponsabilidad, conservando estado, eventos, temporizadores y comportamiento.- Porcentaje de batería, Búsqueda, Vista de tareas y Widgets siguen directamentediff --git a/apps/dock/src/app/activation.rs b/apps/dock/src/app/activation.rsindex 5be6031..5691401 100644--- a/apps/dock/src/app/activation.rs+++ b/apps/dock/src/app/activation.rs@@ -5,7 +5,7 @@ use std::{sync::atomic::Ordering, time::Instant};use anyhow::Result;use muelle_core::bounce;use muelle_shell::{- status,+ launcher, status,system::{animations_enabled, set_window_transitions},tracker,};@@ -605,6 +605,16 @@ impl App {Ok(())}+ /// The hidden taskbar got the focus (see `taskbar::is_hidden`): it goes+ /// to the window in front instead, or to the desktop when none is left,+ /// so that no tooltip of the invisible taskbar shows (issue #48).+ pub(super) fn leave_hidden_taskbar(&mut self) -> Result<()> {+ self.on_foreground_changed()?;+ let windows: Vec<isize> = self.windows.iter().map(|window| window.hwnd).collect();+ launcher::focus_front_or_desktop(&windows);+ Ok(())+ }+pub(super) fn read_windows(&mut self) -> bool {self.windows = self.trackerdiff --git a/apps/dock/src/app/events.rs b/apps/dock/src/app/events.rsindex 51b5eee..819bf82 100644--- a/apps/dock/src/app/events.rs+++ b/apps/dock/src/app/events.rs@@ -3,7 +3,7 @@use std::sync::atomic::Ordering;use anyhow::Result;-use muelle_shell::{power, tracker};+use muelle_shell::{launcher, power, taskbar, tracker};use windows::Win32::{Foundation::{HWND, LPARAM, LRESULT, POINT, WPARAM},System::Ole::DROPEFFECT,@@ -61,6 +61,8 @@ pub(super) unsafe extern "system" fn on_win_event(} else if event == EVENT_SYSTEM_FOREGROUND {if tracker::is_task_switcher(hwnd) {with_app("Alt+Tab", App::task_switcher_opened);+ } else if taskbar::is_hidden(hwnd) && !launcher::opening_hidden_icons() {+ with_app("barra de tareas oculta", App::leave_hidden_taskbar);} else if !tracker::is_switch_transient(hwnd) {LAST_FRONT.store(hwnd.0 as isize, Ordering::Relaxed);with_app("ventana activa", App::on_foreground_changed);diff --git a/apps/dock/src/app/feedback.rs b/apps/dock/src/app/feedback.rsindex 53ff7b4..9ce4bbc 100644--- a/apps/dock/src/app/feedback.rs+++ b/apps/dock/src/app/feedback.rs@@ -313,10 +313,7 @@ impl App {.map(|window| window.app_id.clone());if let Some(app_id) = app_id {let changed = self.attention_enabled && self.attention.request(hwnd, foreground);- if (changed || !self.attention_enabled)- && self.config.notification_bounce- && animations_enabled()- {+ if (changed || !self.attention_enabled) && animations_enabled() {self.start_bounce(app_id.clone(), Some(ATTENTION_HOPS * bounce::HOP_SECONDS));}if changed {diff --git a/apps/dock/src/app/menus.rs b/apps/dock/src/app/menus.rsindex d96dfec..b0214c8 100644--- a/apps/dock/src/app/menus.rs+++ b/apps/dock/src/app/menus.rs@@ -291,7 +291,7 @@ impl App {},gap,);- let hiding = if self.config.auto_hide {+ let hiding = if self.config.hides_automatically() {text().turn_hiding_off} else {text().turn_hiding_ondiff --git a/apps/dock/src/app/preferences.rs b/apps/dock/src/app/preferences.rsindex 22572c2..001d4e9 100644--- a/apps/dock/src/app/preferences.rs+++ b/apps/dock/src/app/preferences.rs@@ -1,6 +1,6 @@//! Persisted dock preferences, pinned apps and menu-bar coordination.-use std::env;+use std::{env, path::Path};use anyhow::{Context, Result};use muelle_config::{Config, DockGroup};@@ -94,17 +94,18 @@ pub(super) fn roster_from(config: &Config) -> Roster {}pub(super) fn save_settings(roster: &Roster, config: &Config) {- if let Err(error) = save_dock_config(roster, config, false) {+ if let Err(error) = save_dock_config(&muelle_config::default_path(), roster, config, false) {eprintln!("muelle: {error}");}}pub(super) fn save_dock_config(+ path: &Path,roster: &Roster,config: &Config,toggle_hide: bool,) -> Result<Config> {- let saved = muelle_config::update(&muelle_config::default_path(), |saved| {+ let saved = muelle_config::update(path, |saved| {let mut saved = saved.unwrap_or_else(|| config.clone());saved.pinned = roster.pinned().to_vec();saved.groups = roster@@ -118,7 +119,8 @@ pub(super) fn save_dock_config(saved.recent = roster.recent().to_vec();saved.taskbar_pins.clone_from(&config.taskbar_pins);if toggle_hide {- saved.auto_hide = !saved.auto_hide;+ saved.auto_hide = !saved.hides_automatically();+ saved.smart_hide = false;}Ok(saved)})?;@@ -290,7 +292,14 @@ impl App {}pub(super) fn toggle_hiding(&mut self) -> Result<()> {- self.config.auto_hide = save_dock_config(&self.roster, &self.config, true)?.auto_hide;+ let saved = save_dock_config(+ &muelle_config::default_path(),+ &self.roster,+ &self.config,+ true,+ )?;+ self.config.auto_hide = saved.auto_hide;+ self.config.smart_hide = saved.smart_hide;self.apply_edge_settings();self.refresh()?;self.hide_if_unused()?;@@ -375,6 +384,38 @@ mod dock_preferences_tests {};use windows::Win32::Foundation::RECT;+ #[test]+ fn dock_menu_toggles_the_selected_mode_without_creating_combined_policies() -> Result<()> {+ for (auto_hide, smart_hide) in [(false, false), (true, false), (false, true), (true, true)]+ {+ let path = std::env::temp_dir().join(format!(+ "muelle-hide-menu-{}-{auto_hide}-{smart_hide}.json",+ std::process::id()+ ));+ let config = Config {+ auto_hide,+ smart_hide,+ icon_size: 64,+ ..Config::default()+ };+ muelle_config::save(&path, &config)?;+ let snapshot = Config::default(); // The latest saved choice wins over a stale view.+ let saved = save_dock_config(&path, &Roster::default(), &snapshot, true)?;+ assert_eq!(+ (saved.auto_hide, saved.smart_hide),+ (!(auto_hide || smart_hide), false)+ );+ assert_eq!(saved.icon_size, 64);+ let untouched = save_dock_config(&path, &Roster::default(), &snapshot, false)?;+ assert_eq!(+ (untouched.auto_hide, untouched.smart_hide),+ (saved.auto_hide, saved.smart_hide)+ );+ std::fs::remove_file(path)?;+ }+ Ok(())+ }+#[test]fn intelligent_hiding_requires_real_overlap_on_every_dock_edge() {let screen = RECT {diff --git a/apps/dock/src/app/previews.rs b/apps/dock/src/app/previews.rsindex c8ac961..f51e17b 100644--- a/apps/dock/src/app/previews.rs+++ b/apps/dock/src/app/previews.rs@@ -133,7 +133,6 @@ impl App {},stage.scale,Theme::new(stage.key.look),- self.config.show_preview_close_button,)?);// The view owns its animation and dismissal timer while it is open.self.render()?;diff --git a/apps/dock/src/menubar.rs b/apps/dock/src/menubar.rsindex a6f9bb8..60df516 100644--- a/apps/dock/src/menubar.rs+++ b/apps/dock/src/menubar.rs@@ -4967,10 +4967,11 @@ mod island_tests {bar.accessories = None;let mut look = bar.look.clone().context("missing initial menu bar")?;look.track = None;- for scale in [1.0, 1.25, 1.5, 2.0] {+ for (scale, material) in [1.0, 1.25, 1.5, 2.0].into_iter().zip(Material::ALL) {for light in [true, false] {for glass in [true, false] {look.scale = scale;+ look.material = material;look.light = light;look.glass = glass;look.accessories = [None, None];diff --git a/apps/dock/src/multi_window_view.rs b/apps/dock/src/multi_window_view.rsindex 1e3c072..dd9fefd 100644--- a/apps/dock/src/multi_window_view.rs+++ b/apps/dock/src/multi_window_view.rs@@ -202,21 +202,18 @@ fn contains(rect: RECT, point: POINT) -> bool {point.x >= rect.left && point.x < rect.right && point.y >= rect.top && point.y < rect.bottom}-fn thumbnail_top_inset(scale: f32, show_close: bool) -> f32 {- if show_close {- let close = muelle_core::preview::close_button_bounds(- muelle_core::layout::Rect {- x: 0.0,- y: 0.0,- width: CARD_WIDTH,- height: CARD_HEIGHT,- },- scale,- );- close.visual.y + close.visual.height + CLOSE_BUTTON_GAP * scale.max(0.5)- } else {- PREVIEW_INSET * scale- }+/// The thumbnail starts under the close button.+fn thumbnail_top_inset(scale: f32) -> f32 {+ let close = muelle_core::preview::close_button_bounds(+ muelle_core::layout::Rect {+ x: 0.0,+ y: 0.0,+ width: CARD_WIDTH,+ height: CARD_HEIGHT,+ },+ scale,+ );+ close.visual.y + close.visual.height + CLOSE_BUTTON_GAP * scale.max(0.5)}#[derive(Clone, Copy, Debug, PartialEq, Eq)]@@ -228,9 +225,9 @@ pub enum MultiWindowAction {struct Card {root: ContainerVisual,highlight: SpriteVisual,- close_btn: Option<SpriteVisual>,- close_normal_brush: Option<CompositionSurfaceBrush>,- close_hover_brush: Option<CompositionSurfaceBrush>,+ close_btn: SpriteVisual,+ close_normal_brush: CompositionSurfaceBrush,+ close_hover_brush: CompositionSurfaceBrush,}pub struct MultiWindowView {@@ -249,7 +246,6 @@ pub struct MultiWindowView {animated: bool,left_at: Option<Instant>,pressed: Option<usize>,- show_close: bool,close_hovered: Option<usize>,close_pressed: Option<usize>,mouse_was_down: bool,@@ -277,7 +273,6 @@ impl MultiWindowView {at: &Anchor,scale: f32,theme: Theme,- show_close: bool,) -> Result<Self> {// SAFETY: Class and window belong to this UI thread. Once created,// `view` owns the HWND even if subsequent graphics setup fails.@@ -323,7 +318,6 @@ impl MultiWindowView {animated: animations_enabled(),left_at: None,pressed: None,- show_close,close_hovered: None,close_pressed: None,mouse_was_down: false,@@ -492,7 +486,7 @@ impl MultiWindowView {})?;card.Children()?.InsertAtTop(&caption)?;- let (close_btn, close_normal_brush, close_hover_brush) = if self.show_close {+ let (close_btn, close_normal_brush, close_hover_brush) = {let card_rect = muelle_core::layout::Rect {x: 0.0,y: 0.0,@@ -518,9 +512,7 @@ impl MultiWindowView {btn_visual.SetOpacity(0.0)?;card.Children()?.InsertAtTop(&btn_visual)?;- (Some(btn_visual), Some(normal_brush), Some(hover_brush))- } else {- (None, None, None)+ (btn_visual, normal_brush, hover_brush)};layers.InsertAtTop(&card)?;@@ -550,11 +542,7 @@ impl MultiWindowView {let eased = 1.0 - (1.0 - progress).powi(3);let cursor = self.local_cursor()?;let hovered = self.layout.hit(cursor);- let close_hovered = if self.show_close {- self.layout.hit_close(cursor, self.scale)- } else {- None- };+ let close_hovered = self.layout.hit_close(cursor, self.scale);if progress >= 1.0 && self.drawn == Some(hovered) && self.close_hovered == close_hovered {return Ok(());}@@ -581,26 +569,19 @@ impl MultiWindowView {card.root.SetOpacity(eased)?;card.highlight.SetOpacity(if hovered == Some(index) { 1.0 } else { 0.0 })?;- if let Some(btn) = &card.close_btn {- let is_close_hovered = close_hovered == Some(index);- let is_card_hovered = hovered == Some(index);- if let (Some(hover_brush), Some(normal_brush)) =- (&card.close_hover_brush, &card.close_normal_brush)- {- btn.SetBrush(if is_close_hovered {- hover_brush- } else {- normal_brush- })?;- }- btn.SetOpacity(if is_card_hovered { 1.0 } else { 0.0 })?;- }+ card.close_btn.SetBrush(if close_hovered == Some(index) {+ &card.close_hover_brush+ } else {+ &card.close_normal_brush+ })?;+ card.close_btn+ .SetOpacity(if hovered == Some(index) { 1.0 } else { 0.0 })?;if let Some(&hwnd) = self.windows.get(self.page + index) {self.thumbnails.place_preview(hwnd,RECT {left: (x + PREVIEW_INSET * self.scale).round() as i32,- top: (y + thumbnail_top_inset(self.scale, self.show_close)).round() as i32,+ top: (y + thumbnail_top_inset(self.scale)).round() as i32,right: (x + width - PREVIEW_INSET * self.scale).round() as i32,bottom: (y + (CARD_HEIGHT - 31.0) * self.scale).round() as i32,},@@ -670,9 +651,7 @@ impl MultiWindowView {fn press_at(&mut self, point: POINT) {// Do not select a card while it is still moving past another card.if !self.animated || self.opened.elapsed().as_secs_f32() >= OPEN_SECONDS {- if self.show_close- && let Some(index) = self.layout.hit_close(point, self.scale)- {+ if let Some(index) = self.layout.hit_close(point, self.scale) {self.close_pressed = Some(index);self.pressed = None;return;@@ -823,17 +802,12 @@ mod tests {scale,);assert!(- thumbnail_top_inset(scale, true)+ thumbnail_top_inset(scale)>= close.visual.y + close.visual.height + CLOSE_BUTTON_GAP * scale);}}- #[test]- fn thumbnail_keeps_original_top_inset_when_close_button_is_disabled() {- assert_eq!(thumbnail_top_inset(1.0, false), PREVIEW_INSET);- }-#[test]#[ignore = "requires an interactive Windows desktop and DWM"]fn native_multi_window_view_should_page_select_without_focus_and_release_its_window()@@ -927,7 +901,6 @@ mod tests {},1.0,theme,- true,)?;view.animated = false;view.update()?;@@ -974,9 +947,7 @@ mod tests {"each preview must align with its card's caption baseline");assert!(- image.top- >= (rect.top as f32 + thumbnail_top_inset(view.scale, view.show_close))- .round() as i32,+ image.top >= (rect.top as f32 + thumbnail_top_inset(view.scale)).round() as i32,"the DWM thumbnail must leave room for the close button");}diff --git a/apps/dock/src/scene.rs b/apps/dock/src/scene.rsindex f855e55..1131c4a 100644--- a/apps/dock/src/scene.rs+++ b/apps/dock/src/scene.rs@@ -48,9 +48,9 @@ pub struct Theme {/// Aurora: green, violet and pink lights over a night-blue tint.const AURORA: [Color; 3] = [- rgba(36, 214, 168, 120),- rgba(118, 92, 255, 110),- rgba(246, 96, 182, 105),+ rgba(36, 214, 168, 150),+ rgba(118, 92, 255, 140),+ rgba(246, 96, 182, 132),];impl Theme {@@ -66,7 +66,7 @@ impl Theme {let tint = match (material, light) {(Material::Standard, true) => pick(rgba(255, 255, 255, 46), rgba(226, 226, 228, 255)),(Material::Standard, false) => pick(rgba(28, 28, 30, 82), rgba(44, 44, 46, 255)),- (Material::Frosted, _) => pick(rgba(250, 251, 253, 158), rgba(236, 238, 242, 255)),+ (Material::Frosted, _) => pick(rgba(250, 251, 253, 184), rgba(236, 238, 242, 255)),(Material::Clear, _) => pick(rgba(255, 255, 255, 14), rgba(38, 40, 46, 255)),(Material::Aurora, _) => pick(rgba(12, 16, 42, 92), rgba(22, 22, 50, 255)),};@@ -113,7 +113,7 @@ impl Theme {let tint = match (look.material, look.light) {(Material::Standard, true) => pick(rgba(255, 255, 255, 110), rgba(236, 236, 238, 255)),(Material::Standard, false) => pick(rgba(24, 24, 26, 120), rgba(36, 36, 38, 255)),- (Material::Frosted, _) => pick(rgba(250, 251, 253, 178), rgba(238, 240, 244, 255)),+ (Material::Frosted, _) => pick(rgba(250, 251, 253, 196), rgba(238, 240, 244, 255)),(Material::Clear, _) => pick(rgba(0, 0, 0, 38), rgba(30, 32, 38, 255)),(Material::Aurora, _) => pick(rgba(10, 14, 38, 120), rgba(20, 20, 46, 255)),};diff --git a/apps/settings/src-tauri/capabilities/default.json b/apps/settings/src-tauri/capabilities/default.jsonindex 12e34b5..82c9c18 100644--- a/apps/settings/src-tauri/capabilities/default.json+++ b/apps/settings/src-tauri/capabilities/default.json@@ -9,6 +9,7 @@"core:window:allow-destroy","core:window:allow-minimize","core:window:allow-toggle-maximize",- "core:window:allow-start-dragging"+ "core:window:allow-start-dragging",+ "core:window:allow-set-theme"]}diff --git a/apps/settings/src-tauri/gen/schemas/capabilities.json b/apps/settings/src-tauri/gen/schemas/capabilities.jsonindex a9009fa..55048fd 100644--- a/apps/settings/src-tauri/gen/schemas/capabilities.json+++ b/apps/settings/src-tauri/gen/schemas/capabilities.json@@ -1 +1 @@-{"default":{"identifier":"default","description":"What the settings window may do.","local":true,"windows":["main"],"permissions":["core:default","core:window:allow-close","core:window:allow-destroy","core:window:allow-minimize","core:window:allow-toggle-maximize","core:window:allow-start-dragging"]}}\ No newline at end of file+{"default":{"identifier":"default","description":"What the settings window may do.","local":true,"windows":["main"],"permissions":["core:default","core:window:allow-close","core:window:allow-destroy","core:window:allow-minimize","core:window:allow-toggle-maximize","core:window:allow-start-dragging","core:window:allow-set-theme"]}}\ No newline at end of filediff --git a/apps/settings/src/App.tsx b/apps/settings/src/App.tsxindex 5893d8b..e20ad50 100644--- a/apps/settings/src/App.tsx+++ b/apps/settings/src/App.tsx@@ -3,10 +3,12 @@ import { listen } from "@tauri-apps/api/event";import { getCurrentWindow } from "@tauri-apps/api/window";import { useCallback, useEffect, useRef, useState } from "react";import {+ type Appearance,type Config,type DockPosition,type DockDensity,type DockAutoHideSpeed,+ type DockHidingMode,type GenieSpeed,type IslandStyle,type Language,@@ -28,8 +30,8 @@ import {saveConfig,setAutostart,} from "./config";-import { Card, Row, Segmented, Slider, SubRow, Toggle, VisualChoices } from "./controls";-import { DockPreview, IslandPreview, SettingIcon, SpeedPreview } from "./visuals";+import { Card, Row, Segmented, Select, Slider, SubRow, Toggle, VisualChoices } from "./controls";+import { DockPreview, IslandPreview, SettingIcon, SpeedPreview, ThemePreview } from "./visuals";import { type SectionId, SectionIcon } from "./icons";import { UpdateBanner } from "./UpdateBanner";import en from "./i18n/en.json";@@ -257,6 +259,11 @@ export function App() {.catch(() => setFailed(true));}, [confirmingReset, update]);+ const appearance = config?.appearance ?? "auto";+ useEffect(() => {+ getCurrentWindow().setTheme(windowTheme(appearance)).catch(() => {});+ }, [appearance]);+if (!config) return <div className="window" />;const t = textsFor(config.language);const durationFormat = new Intl.NumberFormat(config.language === "auto" ? navigator.language : config.language);@@ -360,7 +367,25 @@ export function App() {/>) : null}<div className="content-body" key={section}>- {section === "dock" ? (+ {section === "appearance" ? (+ <>+ <Card>+ <VisualChoices<Appearance>+ label={t.theme}+ columns={3}+ value={config.appearance ?? "auto"}+ options={THEMES.map((theme) => ({+ value: theme,+ label: themeName(t, theme),+ detail: theme === "auto" ? t.themeAutoDetail : undefined,+ preview: <ThemePreview appearance={theme} wallpaper={wallpaper} />,+ }))}+ onChange={(appearance) => update({ appearance })}+ />+ <p className="card-note row-hint">{t.themeHint}</p>+ </Card>+ </>+ ) : section === "dock" ? (<><Card title={t.groupAppearance}><VisualChoices<DockPosition>@@ -424,16 +449,18 @@ export function App() {</Row></Card><Card title={t.groupBehavior}>- <Row icon={<SettingIcon name="hide" />} label={t.autoHide} hint={t.autoHideHint}>- <Toggle- label={t.autoHide}- checked={config.autoHide}- onChange={(autoHide) => update({ autoHide })}+ <Row label={t.dockHidingMode} hint={config.autoHide ? t.dockHidingAutomaticHint : config.smartHide ? t.dockHidingIntelligentHint : t.dockHidingVisibleHint}>+ <Select<DockHidingMode>+ label={t.dockHidingMode}+ value={config.autoHide ? "automatic" : config.smartHide ? "intelligent" : "visible"}+ options={[+ { value: "visible", label: t.dockHidingVisible },+ { value: "automatic", label: t.dockHidingAutomatic },+ { value: "intelligent", label: t.dockHidingIntelligent },+ ]}+ onChange={(mode) => update({ autoHide: mode === "automatic", smartHide: mode === "intelligent" })}/></Row>- <Row label={t.smartHide} hint={config.autoHide ? t.smartHidePausedHint : t.smartHideHint}>- <Toggle label={t.smartHide} checked={config.smartHide ?? false} disabled={config.autoHide} onChange={(smartHide) => update({ smartHide })} />- </Row><SubRow label={t.dockAutoHideSpeed} open={config.autoHide || (config.smartHide ?? false)}><Segmented<DockAutoHideSpeed>label={t.dockAutoHideSpeed}@@ -449,9 +476,6 @@ export function App() {<Row label={t.notificationBadges} hint={t.notificationBadgesHint}><Toggle label={t.notificationBadges} checked={config.notificationBadges} onChange={(notificationBadges) => update({ notificationBadges })} /></Row>- <Row label={t.notificationBounce} hint={t.notificationBounceHint}>- <Toggle label={t.notificationBounce} checked={config.notificationBounce} onChange={(notificationBounce) => update({ notificationBounce })} />- </Row><Row icon={<SettingIcon name="bounce" />} label={t.bounceOnOpen}><Togglelabel={t.bounceOnOpen}@@ -538,13 +562,6 @@ export function App() {onChange={(showMinimized) => update({ showMinimized })}/></Row>- <Row label={t.showPreviewCloseButton} hint={t.showPreviewCloseButtonHint}>- <Toggle- label={t.showPreviewCloseButton}- checked={config.showPreviewCloseButton}- onChange={(showPreviewCloseButton) => update({ showPreviewCloseButton })}- />- </Row></Card><Card><Row label={t.showOtherWorkspaces} hint={t.showOtherWorkspacesHint}>@@ -707,10 +724,35 @@ function updateHint(t: Texts, state: UpdateState, version: string): string {}}-const SECTIONS: readonly SectionId[] = ["dock", "windows", "menubar", "system"];+const SECTIONS: readonly SectionId[] = ["appearance", "dock", "windows", "menubar", "system"];++const THEMES: readonly Appearance[] = ["auto", "light", "dark", "frosted", "clear", "aurora"];++function themeName(t: Texts, theme: Appearance): string {+ switch (theme) {+ case "auto":+ return t.themeAuto;+ case "light":+ return t.themeLight;+ case "dark":+ return t.themeDark;+ case "frosted":+ return t.themeFrosted;+ case "clear":+ return t.themeClear;+ case "aurora":+ return t.themeAurora;+ }+}++/** Settings takes the theme's light or dark too, as macOS apps take its appearance. */+const windowTheme = (theme: Appearance) =>+ theme === "auto" ? null : theme === "light" || theme === "frosted" ? "light" : "dark";function sectionTitle(t: Texts, section: SectionId): string {switch (section) {+ case "appearance":+ return t.appearance;case "dock":return t.dock;case "windows":diff --git a/apps/settings/src/config.ts b/apps/settings/src/config.tsindex 6e9f017..4ac5a5b 100644--- a/apps/settings/src/config.ts+++ b/apps/settings/src/config.ts@@ -6,6 +6,10 @@ export type GenieSpeed = "normal" | "fast" | "faster";export type DockPosition = "left" | "bottom" | "right";export type DockDensity = "compact" | "normal" | "spacious";export type DockAutoHideSpeed = "smooth" | "normal" | "fast";+/** View of the existing two settings; saved atomically as a mutually exclusive pair. */+export type DockHidingMode = "visible" | "automatic" | "intelligent";+/** `auto` follows Windows' light or dark mode. */+export type Appearance = "auto" | "light" | "dark" | "frosted" | "clear" | "aurora";/** Mirrors `muelle_config::Config`. */export interface Config {@@ -28,7 +32,6 @@ export interface Config {genieSpeed: GenieSpeed;showMinimized: boolean;showOtherWorkspaces: boolean;- showPreviewCloseButton: boolean;jumpLists: boolean;menuBar: boolean;menuBarAutoHide: boolean;@@ -40,11 +43,11 @@ export interface Config {showRecents: boolean;bounceOnOpen: boolean;notificationBadges: boolean;- notificationBounce: boolean;mascot: boolean;checkUpdates: boolean;autoUpdate: boolean;language: Language;+ appearance: Appearance;/** The folder shown at the right of the dock, whose contents open as a menu. */shortcutsFolder: string | null;}diff --git a/apps/settings/src/controls.tsx b/apps/settings/src/controls.tsxindex a190622..db39835 100644--- a/apps/settings/src/controls.tsx+++ b/apps/settings/src/controls.tsx@@ -113,21 +113,43 @@ export function Slider({ value, min, max, label, unit = "px", disabled, onChange);}+interface SelectProps<T extends string> {+ value: T;+ label: string;+ options: readonly { value: T; label: string }[];+ onChange: (value: T) => void;+}++/** Native popup and keyboard navigation, styled like the other Settings controls. */+export function Select<T extends string>({ value, label, options, onChange }: SelectProps<T>) {+ return <span className="select-wrap">+ <select className="select-control" aria-label={label} value={value}+ onChange={(event) => onChange(event.target.value as T)}>+ {options.map((option) => <option key={option.value} value={option.value}>{option.label}</option>)}+ </select>+ <svg className="select-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.6" aria-hidden="true">+ <path d="m4 6 4 4 4-4" strokeLinecap="round" strokeLinejoin="round" />+ </svg>+ </span>;+}+interface VisualChoicesProps<T extends string> {label: string;value: T;hideLabel?: boolean;+ /** Wrap into rows of this many; one row by default. */+ columns?: number;options: readonly { value: T; label: string; preview: ReactNode; detail?: string }[];onChange: (value: T) => void;}/** Native radios provide arrow-key navigation without extra listeners or state. */-export function VisualChoices<T extends string>({ label, value, hideLabel, options, onChange }: VisualChoicesProps<T>) {+export function VisualChoices<T extends string>({ label, value, hideLabel, columns, options, onChange }: VisualChoicesProps<T>) {const name = useId();return (<fieldset className="visual-setting"><legend className={hideLabel ? "sr-only" : "visual-legend"}>{label}</legend>- <div className="visual-choices" style={{ gridTemplateColumns: `repeat(${options.length}, minmax(0, 1fr))` }}>+ <div className="visual-choices" style={{ gridTemplateColumns: `repeat(${columns ?? options.length}, minmax(0, 1fr))` }}>{options.map((option) => (<label className="visual-choice" key={option.value}><input type="radio" name={name} value={option.value} checked={value === option.value}diff --git a/apps/settings/src/i18n/en.json b/apps/settings/src/i18n/en.jsonindex 5667098..d633cc5 100644--- a/apps/settings/src/i18n/en.json+++ b/apps/settings/src/i18n/en.json@@ -13,6 +13,16 @@"dockAutoHideSpeed": "Animation speed","dockAutoHideSmooth": "Smooth","system": "System",+ "appearance": "Appearance",+ "theme": "Theme",+ "themeHint": "For the dock, the menu bar and their menus. Glass themes look solid while Windows transparency effects or energy saver are on.",+ "themeAuto": "Automatic",+ "themeAutoDetail": "Follows Windows",+ "themeLight": "Light",+ "themeDark": "Dark",+ "themeFrosted": "Frosted glass",+ "themeClear": "Clear",+ "themeAurora": "Aurora","size": "Size","small": "Small","large": "Large",@@ -23,8 +33,6 @@"dockPositionLeft": "Left","dockPositionBottom": "Bottom","dockPositionRight": "Right",- "autoHide": "Automatically hide",- "autoHideHint": "Hide the Dock until you rest the pointer at its edge, even on the desktop.","genie": "Genie effect","genieHint": "While it is on, windows do not use the Windows animations for maximizing or closing.","genieSpeed": "Genie speed",@@ -39,8 +47,6 @@"showMinimizedHint": "Thumbnails separate from app icons.","showOtherWorkspaces": "Show windows from other workspaces","showOtherWorkspacesHint": "Reuse open windows across Windows virtual desktops and compatible tiling workspaces, such as komorebi's Cloak mode.",- "showPreviewCloseButton": "Show close button on previews",- "showPreviewCloseButtonHint": "Displays a close button on window hover previews and allows middle-clicking to close.","menuBar": "Menu bar","menuBarHint": "Time, battery, and access to the Windows quick settings and notifications.","menuBarAutoHide": "Automatically hide",@@ -109,13 +115,15 @@"shortcutsFolderRemove": "Remove","notificationBadges": "App attention indicator","notificationBadgesHint": "Show an indicator when Windows reports that an app needs attention.",- "notificationBounce": "Bounce icon on alert",- "notificationBounceHint": "Bounces the Dock icon when an app requests attention.","groupAppearance": "Appearance","githubTitle": "Muelle on GitHub","githubStar": "Support with a star","githubError": "Could not open GitHub. Try again.",- "smartHide": "Intelligent hiding",- "smartHideHint": "Keep the Dock visible on the desktop; hide it when the active window overlaps it.",- "smartHidePausedHint": "Paused while automatic hiding is on. Turn it off to keep the Dock visible on the desktop."+ "dockHidingMode": "Dock visibility",+ "dockHidingVisible": "Always visible",+ "dockHidingAutomatic": "Automatic",+ "dockHidingIntelligent": "Intelligent",+ "dockHidingVisibleHint": "Keep the Dock visible while you work.",+ "dockHidingAutomaticHint": "Hidden until you rest the pointer at its edge, even on the desktop.",+ "dockHidingIntelligentHint": "Visible on the desktop. Hides when the active window overlaps it."}diff --git a/apps/settings/src/i18n/es.json b/apps/settings/src/i18n/es.jsonindex 2da4927..d20a693 100644--- a/apps/settings/src/i18n/es.json+++ b/apps/settings/src/i18n/es.json@@ -13,6 +13,16 @@"dockAutoHideSpeed": "Velocidad de la animación","dockAutoHideSmooth": "Suave","system": "Sistema",+ "appearance": "Apariencia",+ "theme": "Tema",+ "themeHint": "Para el dock, la barra superior y sus menús. Los temas de cristal se ven sólidos mientras Windows tenga desactivados los efectos de transparencia o activado el ahorro de energía.",+ "themeAuto": "Automático",+ "themeAutoDetail": "Sigue a Windows",+ "themeLight": "Claro",+ "themeDark": "Oscuro",+ "themeFrosted": "Cristal esmerilado",+ "themeClear": "Transparente",+ "themeAurora": "Aurora","size": "Tamaño","small": "Pequeño","large": "Grande",@@ -23,8 +33,6 @@"dockPositionLeft": "Izquierda","dockPositionBottom": "Abajo","dockPositionRight": "Derecha",- "autoHide": "Ocultar automáticamente",- "autoHideHint": "Oculta el Dock hasta que dejes el puntero en su borde, incluso en el escritorio.","genie": "Efecto genio","genieHint": "Mientras está activo, las ventanas no usan las animaciones de Windows al maximizar ni al cerrar.","genieSpeed": "Velocidad del genio",@@ -39,8 +47,6 @@"showMinimizedHint": "Miniaturas separadas de los iconos de las apps.","showOtherWorkspaces": "Mostrar ventanas de otros espacios de trabajo","showOtherWorkspacesHint": "Reutiliza ventanas abiertas en escritorios virtuales de Windows y espacios compatibles, como el modo Cloak de komorebi.",- "showPreviewCloseButton": "Mostrar botón de cerrar en previsualizaciones",- "showPreviewCloseButtonHint": "Muestra un botón de cerrar en las previsualizaciones y permite cerrar con clic central.","menuBar": "Barra superior","menuBarHint": "Hora, batería y acceso a los ajustes rápidos y las notificaciones de Windows.","menuBarAutoHide": "Ocultar automáticamente",@@ -109,13 +115,15 @@"shortcutsFolderRemove": "Quitar","notificationBadges": "Indicador de atención","notificationBadgesHint": "Muestra un indicador cuando Windows avisa de que una app necesita atención.",- "notificationBounce": "Animar icono al recibir alerta",- "notificationBounceHint": "Hace rebotar el icono en el Dock cuando la app solicita atención.","groupAppearance": "Aspecto","githubTitle": "Muelle en GitHub","githubStar": "Apoya con una estrella","githubError": "No se pudo abrir GitHub. Inténtalo otra vez.",- "smartHide": "Ocultación inteligente",- "smartHideHint": "Mantiene el Dock visible en el escritorio y lo oculta si la ventana activa ocupa su espacio.",- "smartHidePausedHint": "En pausa mientras la ocultación automática esté activa. Desactívala para mantener el Dock visible en el escritorio."+ "dockHidingMode": "Visibilidad del Dock",+ "dockHidingVisible": "Siempre visible",+ "dockHidingAutomatic": "Automática",+ "dockHidingIntelligent": "Inteligente",+ "dockHidingVisibleHint": "Mantiene el Dock visible mientras trabajas.",+ "dockHidingAutomaticHint": "Se oculta hasta que dejes el puntero en su borde, incluso en el escritorio.",+ "dockHidingIntelligentHint": "Visible en el escritorio. Se oculta si la ventana activa ocupa su espacio."}diff --git a/apps/settings/src/i18n/fr.json b/apps/settings/src/i18n/fr.jsonindex 2b00130..cdae1fb 100644--- a/apps/settings/src/i18n/fr.json+++ b/apps/settings/src/i18n/fr.json@@ -13,6 +13,16 @@"dockAutoHideSpeed": "Vitesse de l’animation","dockAutoHideSmooth": "Douce","system": "Système",+ "appearance": "Apparence",+ "theme": "Thème",+ "themeHint": "Pour le Dock, la barre de menus et leurs menus. Les thèmes en verre paraissent opaques tant que les effets de transparence de Windows sont désactivés ou que l'économiseur d'énergie est activé.",+ "themeAuto": "Automatique",+ "themeAutoDetail": "Suit Windows",+ "themeLight": "Clair",+ "themeDark": "Sombre",+ "themeFrosted": "Verre dépoli",+ "themeClear": "Transparent",+ "themeAurora": "Aurore","size": "Taille","small": "Petite","large": "Grande",@@ -23,8 +33,6 @@"dockPositionLeft": "Gauche","dockPositionBottom": "Bas","dockPositionRight": "Droite",- "autoHide": "Masquer automatiquement",- "autoHideHint": "Masque le Dock jusqu’à ce que le pointeur reste sur son bord, même sur le bureau.","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.","genieSpeed": "Vitesse du génie",@@ -39,8 +47,6 @@"showMinimizedHint": "Des miniatures séparées des icônes des apps.","showOtherWorkspaces": "Afficher les fenêtres des autres espaces de travail","showOtherWorkspacesHint": "Réutilise les fenêtres ouvertes sur les bureaux virtuels Windows et les espaces compatibles, comme le mode Cloak de komorebi.",- "showPreviewCloseButton": "Afficher le bouton de fermeture sur les aperçus",- "showPreviewCloseButtonHint": "Affiche un bouton de fermeture sur les aperçus et permet de fermer avec le clic du milieu.","menuBar": "Barre de menus","menuBarHint": "Heure, batterie et accès aux paramètres rapides et aux notifications de Windows.","menuBarAutoHide": "Masquer automatiquement",@@ -109,13 +115,15 @@"shortcutsFolderRemove": "Retirer","notificationBadges": "Indicateur d’attention","notificationBadgesHint": "Affiche un indicateur lorsque Windows signale une demande d’attention.",- "notificationBounce": "Animer l'icône lors d'une alerte",- "notificationBounceHint": "Fait rebondir l'icône dans le Dock lorsqu'une application demande de l'attention.","groupAppearance": "Apparence","githubTitle": "Muelle sur GitHub","githubStar": "Soutenir avec une étoile","githubError": "Impossible d'ouvrir GitHub. Réessayez.",- "smartHide": "Masquage intelligent",- "smartHideHint": "Garde le Dock visible sur le bureau et le masque si la fenêtre active le recouvre.",- "smartHidePausedHint": "En pause pendant le masquage automatique. Désactivez-le pour garder le Dock visible sur le bureau."+ "dockHidingMode": "Visibilité du Dock",+ "dockHidingVisible": "Toujours visible",+ "dockHidingAutomatic": "Automatique",+ "dockHidingIntelligent": "Intelligent",+ "dockHidingVisibleHint": "Garde le Dock visible pendant votre travail.",+ "dockHidingAutomaticHint": "Masqué jusqu’à ce que le pointeur reste sur son bord, même sur le bureau.",+ "dockHidingIntelligentHint": "Visible sur le bureau. Se masque si la fenêtre active le recouvre."}diff --git a/apps/settings/src/icons.tsx b/apps/settings/src/icons.tsxindex 8b10062..5fc19ad 100644--- a/apps/settings/src/icons.tsx+++ b/apps/settings/src/icons.tsx@@ -6,9 +6,10 @@import type { ReactNode } from "react";-export type SectionId = "dock" | "windows" | "menubar" | "system";+export type SectionId = "appearance" | "dock" | "windows" | "menubar" | "system";const TILES: Record<SectionId, [string, string]> = {+ appearance: ["#5c5c62", "#1c1c1e"],dock: ["#4aa3ff", "#0a6cf0"],windows: ["#b57bff", "#7d3ff0"],menubar: ["#ff9f45", "#f0640a"],@@ -16,6 +17,13 @@ const TILES: Record<SectionId, [string, string]> = {};const GLYPHS: Record<SectionId, ReactNode> = {+ // A circle half light, half dark, as macOS draws Appearance.+ appearance: (+ <>+ <circle cx="12" cy="12" r="6.6" fill="none" stroke="#fff" strokeWidth="1.6" />+ <path d="M12 5.4a6.6 6.6 0 0 1 0 13.2z" fill="#fff" />+ </>+ ),// A dock: three icons on a shelf.dock: (<>diff --git a/apps/settings/src/styles.css b/apps/settings/src/styles.cssindex 32cdcf7..b14723e 100644--- a/apps/settings/src/styles.css+++ b/apps/settings/src/styles.css@@ -554,6 +554,30 @@ input:focus-visible {.preview-wave i:nth-child(3) { height: 6px; }.preview-speed { width: 100%; max-width: 120px; height: 48px; color: var(--text-dim); }+.card-note { margin: 0; padding: 0 14px 14px; }++/* Themes: the same tints, blur and rims the dock draws (scene.rs), at preview size. */+.preview-theme { height: 92px; }+.theme-layer { position: absolute; inset: 0; --ink: rgba(0, 0, 0, 0.7); --bar: rgba(255, 255, 255, 0.43); --dock: rgba(255, 255, 255, 0.18); --rim: rgba(255, 255, 255, 0.55); --blur: blur(5px) saturate(1.6); }+.theme-layer[data-half] { clip-path: polygon(58% 0, 100% 0, 100% 100%, 42% 100%); }+.theme-bar { position: absolute; inset: 0 0 auto; height: 10px; display: flex; align-items: center; gap: 3px; padding: 0 6px; background: var(--bar); backdrop-filter: var(--blur); }+.theme-bar i { width: 8px; height: 2px; border-radius: 2px; background: var(--ink); }+.theme-bar i:first-child { width: 4px; }+.theme-bar b { width: 12px; height: 2px; margin-left: auto; border-radius: 2px; background: var(--ink); }+.theme-dock { position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%); display: flex; gap: 3px; padding: 3px; border-radius: 6px; background: var(--dock); backdrop-filter: var(--blur); box-shadow: inset 0 0 0 0.5px var(--rim), inset 0 6px 6px -6px rgba(255, 255, 255, 0.35), 0 2px 5px rgba(0, 0, 0, 0.22); }+.theme-dock i { width: 9px; height: 9px; border-radius: 2.5px; background: #338fe9; }+.theme-dock i:nth-child(2) { background: #f0b249; }+.theme-dock i:nth-child(3) { background: #a488d5; }+.theme-dock i:nth-child(4) { background: #70bfa4; }+.theme-dock i:nth-child(5) { background: #d68093; }+.theme-layer[data-theme="dark"] { --ink: rgba(255, 255, 255, 0.85); --bar: rgba(24, 24, 26, 0.47); --dock: rgba(28, 28, 30, 0.32); --rim: rgba(255, 255, 255, 0.3); }+.theme-layer[data-theme="frosted"] { --bar: rgba(250, 251, 253, 0.77); --dock: rgba(250, 251, 253, 0.72); --rim: rgba(255, 255, 255, 0.9); --blur: blur(10px) saturate(1.4); }+.theme-layer[data-theme="clear"] { --ink: #fff; --bar: rgba(0, 0, 0, 0.15); --dock: rgba(255, 255, 255, 0.06); --rim: rgba(255, 255, 255, 0.9); --blur: blur(2.5px) saturate(1.5); }+.theme-layer[data-theme="clear"] .theme-bar i, .theme-layer[data-theme="clear"] .theme-bar b { box-shadow: 0 0 2px rgba(0, 0, 0, 0.5); }+.theme-layer[data-theme="aurora"] { --ink: #fff; --rim: rgba(255, 255, 255, 0.45); }+.theme-layer[data-theme="aurora"] .theme-bar { background: linear-gradient(90deg, rgba(36, 214, 168, 0.59), rgba(118, 92, 255, 0.55), rgba(246, 96, 182, 0.52)), rgba(10, 14, 38, 0.47); }+.theme-layer[data-theme="aurora"] .theme-dock { background: linear-gradient(135deg, rgba(36, 214, 168, 0.59), rgba(118, 92, 255, 0.55), rgba(246, 96, 182, 0.52)), rgba(12, 16, 42, 0.36); }+.slider input:disabled {opacity: 0.4;}@@ -645,3 +669,13 @@ input:focus-visible {animation: none;}}++++/* Native select: the platform owns popup behavior and keyboard navigation. */+.select-wrap { position: relative; display: inline-flex; max-width: 100%; }+.select-control { appearance: none; min-width: 170px; max-width: 100%; padding: 6px 30px 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--segment); color: var(--text); font: inherit; cursor: default; }+.select-control:hover { border-color: var(--text-dim); }+.select-control:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }+.select-control option { background: var(--content); color: var(--text); }+.select-chevron { position: absolute; right: 9px; top: 50%; width: 12px; height: 12px; transform: translateY(-50%); pointer-events: none; color: var(--text-dim); }diff --git a/apps/settings/src/visuals.tsx b/apps/settings/src/visuals.tsxindex 0e0610b..ec372f9 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 { DockDensity, DockPosition, GenieSpeed, IslandStyle } from "./config";+import type { Appearance, 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" /></>,@@ -42,6 +42,28 @@ export function DockPreview({ position, iconSize, wallpaper, density = "normal"</span>;}+type Theme = Exclude<Appearance, "auto">;++/** One theme's bar and dock over the wallpaper. Each layer carries its own+ * wallpaper: a clipped layer cannot blur what lies outside it. */+function ThemeLayer({ theme, wallpaper, half }: { theme: Theme; wallpaper: string | null; half?: boolean }) {+ return <span className="theme-layer" data-theme={theme} data-half={half ? "" : undefined}>+ {wallpaper ? <img className="preview-wallpaper" src={wallpaper} alt="" /> : null}+ <span className="theme-bar"><i /><i /><i /><b /></span>+ <span className="theme-dock">{MINI_ICONS}</span>+ </span>;+}++/** The materials in CSS, as the dock draws them: `auto` shows light and+ * dark split, as macOS shows its automatic appearance. */+export function ThemePreview({ appearance, wallpaper }: { appearance: Appearance; wallpaper: string | null }) {+ return <span className="preview-screen preview-theme">+ {appearance === "auto"+ ? <><ThemeLayer theme="light" wallpaper={wallpaper} /><ThemeLayer theme="dark" wallpaper={wallpaper} half /></>+ : <ThemeLayer theme={appearance} wallpaper={wallpaper} />}+ </span>;+}+export function IslandPreview({ style, wallpaper }: { style: IslandStyle; wallpaper: string | null }) {return <span className="preview-screen preview-screen-island">{wallpaper ? <img className="preview-wallpaper" src={wallpaper} alt="" /> : null}diff --git a/apps/settings/tests/app.test.mjs b/apps/settings/tests/app.test.mjsindex 3eebeba..74a7f81 100644--- a/apps/settings/tests/app.test.mjs+++ b/apps/settings/tests/app.test.mjs@@ -25,14 +25,14 @@ const texts = Object.fromEntries(["en", "es", "fr"].map((language) => [language, JSON.parse(readFileSync(path.join(source, "i18n", `${language}.json`), "utf8")),]));const base = {- language: "en", menuBar: true, smartHide: false, notificationBadges: true, notificationBounce: true,+ language: "en", menuBar: true, smartHide: false, notificationBadges: true,iconSize: 48, magnifiedSize: 77,magnification: true, dockPosition: "bottom", genie: true, genieSpeed: "normal",dockDensity: "normal", dockAutoHideSpeed: "normal", showStart: true,showTrash: true, pinExplorer: true,showDownloads: true,showOtherWorkspaces: false,- menuBarIslandStyle: "notch", checkUpdates: false,+ menuBarIslandStyle: "notch", checkUpdates: false, appearance: "auto",pinned: [], recent: [], shortcutsFolder: null,};const settle = async () => { for (let i = 0; i < 12; i++) await Promise.resolve(); };@@ -63,7 +63,11 @@ function fixture(section = "menubar", config = {}, save = async () => {}) {useCallback(callback) { return callback; },useEffect(callback) { effects.push(callback); },};- const nativeWindow = { onCloseRequested(callback) { close = callback; return Promise.resolve(() => {}); } };+ const nativeWindow = {+ themes: [],+ onCloseRequested(callback) { close = callback; return Promise.resolve(() => {}); },+ setTheme(theme) { this.themes.push(theme); return Promise.resolve(); },+ };const mocks = {"@tauri-apps/api/app": { getVersion: async () => "0.1.21" },"@tauri-apps/api/event": { listen: async () => () => {} },@@ -74,7 +78,7 @@ function fixture(section = "menubar", config = {}, save = async () => {}) {case "get_autostart": return false;case "windows_preferences": return { animations: true };case "wallpaper_preview": return null;- case "default_config": return base;+ case "default_config": return { ...base, autoHide: false, smartHide: true };case "set_config": calls.push({ ...args.patch }); return save(args.patch);default: throw new Error(`Unexpected native call: ${command}`);}@@ -99,7 +103,7 @@ function fixture(section = "menubar", config = {}, save = async () => {}) {function render() { stateIndex = refIndex = 0; effects.length = 0; return App(); }function find(predicate) { const node = [...elements(render())].find(predicate); assert.ok(node); return node; }return {- calls, timers, render,+ calls, timers, render, themes: nativeWindow.themes,external(patch) { Object.assign(loaded, patch); },async focus() { listeners.get("focus")?.(); await settle(); },async mount() { render(); const cleanup = effects.map((effect) => effect()); await settle(); return () => cleanup.forEach((fn) => fn?.()); },@@ -112,7 +116,7 @@ function fixture(section = "menubar", config = {}, save = async () => {}) {}test("each section renders only its own controls, in every language and visibility state", () => {- const markers = { dock: "size", windows: "genie", menubar: "menuBarShow", system: "autostart" };+ const markers = { appearance: "themeHint", dock: "size", windows: "genie", menubar: "menuBarShow", system: "autostart" };for (const language of Object.keys(texts)) for (const menuBar of [true, false]) {for (const section of Object.keys(markers)) {const view = fixture(section, { language, menuBar });@@ -173,36 +177,53 @@ test("other workspaces are opt-in and save without changing other window prefere} finally { unmount(); }});-test("automatic hiding pauses intelligent hiding without discarding its saved choice", async () => {- for (const language of Object.keys(texts)) for (const smartHide of [false, true]) {- const view = fixture("dock", { language, autoHide: true, smartHide });+test("one native dropdown preserves legacy modes and saves exclusive choices atomically", async () => {+ const modes = [+ [false, false, "visible"], [true, false, "automatic"],+ [false, true, "intelligent"], [true, true, "automatic"],+ ];+ for (const language of Object.keys(texts)) for (const [autoHide, smartHide, selected] of modes) {+ const view = fixture("dock", { language, autoHide, smartHide });const unmount = await view.mount();- const smartToggle = () => [...elements(view.body())].find((node) =>- node.props.label === texts[language].smartHide && "checked" in node.props);+ const selector = () => [...elements(view.body())].find((node) =>+ node.props.label === texts[language].dockHidingMode && "value" in node.props);try {- let toggle = smartToggle();- assert.equal(toggle.props.disabled, true);- assert.equal(toggle.props.checked, smartHide);- const button = toggle.type(toggle.props);- assert.equal(button.props.disabled, true);- assert.equal(button.props["aria-busy"], undefined);- button.props.onClick(); // Disabled is not a loading state or a writable control.- view.fire(60);- await settle();- assert.deepEqual(view.calls, []);- const paused = renderToStaticMarkup(React.createElement("span", null, texts[language].smartHidePausedHint)).slice(6, -7);- assert.ok(renderToStaticMarkup(view.body()).includes(paused));- view.change(texts[language].autoHide, false);- view.fire(60);- await settle();- toggle = smartToggle();- assert.equal(toggle.props.disabled, false);- assert.equal(toggle.props.checked, smartHide);- assert.deepEqual(view.calls, [{ autoHide: false }]);+ assert.equal(selector().props.value, selected);+ assert.deepEqual(selector().props.options.map((option) => option.value), ["visible", "automatic", "intelligent"]);+ assert.deepEqual(view.calls, [], "opening Settings must not normalize saved preferences");+ const controls = [...elements(view.body())];+ assert.ok(!controls.some((node) => node.props.label === texts[language].dockHidingMode && "checked" in node.props));+ for (const mode of ["intelligent", "automatic", "visible"]) {+ view.change(texts[language].dockHidingMode, mode);+ view.fire(60);+ await settle();+ assert.equal(selector().props.value, mode);+ assert.deepEqual(view.calls.at(-1), { autoHide: mode === "automatic", smartHide: mode === "intelligent" });+ const html = renderToStaticMarkup(view.body());+ assert.ok(html.includes('<select class="select-control"'));+ const selectedOption = html.match(new RegExp(`<option[^>]*value="${mode}"[^>]*>`));+ assert.ok(selectedOption?.[0].includes('selected=""'));+ assert.ok(!html.includes('preview-hiding'));+ }} finally { unmount(); }}});+test("reset selects the new intelligent default without changing pinned apps", async () => {+ const view = fixture("system", { autoHide: true, smartHide: false });+ const unmount = await view.mount();+ try {+ view.button(texts.en.resetButton);+ view.button(texts.en.resetConfirm);+ await settle();+ view.fire(60);+ await settle();+ assert.equal(view.calls.at(-1).autoHide, false);+ assert.equal(view.calls.at(-1).smartHide, true);+ assert.ok(!("pinned" in view.calls.at(-1)));+ } finally { unmount(); }+});+test("failed writes remain retryable and prevent closing until saved", async () => {let fail = true;const view = fixture("menubar", {}, async () => { if (fail) throw new Error("disk busy"); });@@ -301,3 +322,34 @@ test("returning to Settings reflects dock removals without overwriting local ediassert.deepEqual(view.calls, [{ showDownloads: true }]);} finally { unmount(); }});++test("the theme picker offers every theme with a preview, saves only the choice and themes Settings", async () => {+ const themes = ["auto", "light", "dark", "frosted", "clear", "aurora"];+ for (const language of Object.keys(texts)) {+ const view = fixture("appearance", { language });+ const picker = [...elements(view.body())].find((node) => node.props.label === texts[language].theme);+ assert.deepEqual(picker.props.options.map((option) => option.value), themes);+ assert.ok(picker.props.options.every((option) => option.preview && option.label));+ assert.equal(picker.props.value, "auto");+ }+ const view = fixture("appearance");+ const unmount = await view.mount();+ try {+ assert.deepEqual(view.themes, [null], "automatic follows Windows");+ view.change(texts.en.theme, "frosted");+ view.fire(60);+ await settle();+ assert.deepEqual(view.calls, [{ appearance: "frosted" }]);+ // An old file without the setting reads as automatic.+ const old = fixture("appearance", { appearance: undefined });+ const picker = [...elements(old.body())].find((node) => node.props.label === texts.en.theme);+ assert.equal(picker.props.value, "auto");+ } finally { unmount(); }+});++test("the alert bounce and the preview close button are always on, with no switch left", () => {+ for (const section of ["dock", "windows"]) for (const old of [false, true]) {+ const html = renderToStaticMarkup(fixture(section, { notificationBounce: old, showPreviewCloseButton: old }).body());+ assert.doesNotMatch(html, /Bounce icon on alert|close button on previews/i);+ }+});diff --git a/crates/muelle-config/src/lib.rs b/crates/muelle-config/src/lib.rsindex 3ed7b1f..b007036 100644--- a/crates/muelle-config/src/lib.rs+++ b/crates/muelle-config/src/lib.rs@@ -52,6 +52,9 @@ pub struct Config {#[serde(alias = "auto_hide")]pub auto_hide: bool,/// Hide only when the foreground app overlaps the dock; leave desktop visible.+ /// Missing in an existing file means the legacy always-visible mode. New+ /// installations and Reset use Config::default(), which enables this mode.+ #[serde(default)]pub smart_hide: bool,/// Icon side at rest, in logical pixels.pub icon_size: u32,@@ -119,12 +122,10 @@ pub struct Config {/// menu, with a submenu for each folder inside, like a Windows 10 taskbar/// toolbar. Only one: the user arranges the folder as they like.pub shortcuts_folder: Option<String>,- /// Show a close button ("X") on hover in window preview cards.- pub show_preview_close_button: bool,- /// Indicator on app icons when Windows requests attention.+ /// Indicator on app icons when Windows requests attention. Their icon+ /// always bounces too, and window previews always have a close button:+ /// those two switches were retired, and their saved values are ignored.pub notification_badges: bool,- /// Icon bounce in dock when app requests attention.- pub notification_bounce: bool,}/// Pinned apps the user gathered in one dock icon by dropping one on@@ -308,7 +309,7 @@ impl Default for Config {recent: Vec::new(),taskbar_pins: None,auto_hide: false,- smart_hide: false,+ smart_hide: true,icon_size: 48,magnification: true,dock_position: DockPosition::Bottom,@@ -339,9 +340,7 @@ impl Default for Config {language: Language::Auto,appearance: Appearance::Auto,shortcuts_folder: None,- show_preview_close_button: true,notification_badges: true,- notification_bounce: true,}}}@@ -504,17 +503,46 @@ mod tests {}#[test]- fn intelligent_hiding_defaults_off_and_retired_banner_preferences_are_ignored()+ fn new_installs_use_intelligent_hiding_and_existing_modes_are_preserved()+ -> Result<(), serde_json::Error> {+ let fresh = Config::default();+ assert!(!fresh.auto_hide && fresh.smart_hide);+ let round_trip: Config = serde_json::from_str(&serde_json::to_string(&fresh)?)?;+ assert_eq!(round_trip, fresh);+ for (json, auto, smart) in [+ (r#"{}"#, false, false),+ (r#"{"autoHide":false}"#, false, false),+ (r#"{"autoHide":true}"#, true, false),+ (r#"{"auto_hide":true}"#, true, false),+ (r#"{"autoHide":false,"smartHide":false}"#, false, false),+ (r#"{"autoHide":false,"smartHide":true}"#, false, true),+ (r#"{"autoHide":true,"smartHide":true}"#, true, true),+ ] {+ let existing: Config = serde_json::from_str(json)?;+ assert_eq!(+ (existing.auto_hide, existing.smart_hide),+ (auto, smart),+ "{json}"+ );+ }+ Ok(())+ }++ #[test]+ fn legacy_visible_mode_and_retired_banner_preferences_are_preserved()-> Result<(), serde_json::Error> {let old: Config = serde_json::from_value(serde_json::json!({"notifications": true, "notificationPosition": "top-right","notificationDuration": 5, "notificationDnd": true,- "notificationBadges": false, "autoHide": false+ "notificationBadges": false, "autoHide": false,+ "notificationBounce": false, "showPreviewCloseButton": false}))?;assert!(!old.smart_hide && !old.hides_automatically());assert!(!old.notification_badges);let saved = serde_json::to_value(&old)?;assert!(saved.get("notifications").is_none());+ assert!(saved.get("notificationBounce").is_none());+ assert!(saved.get("showPreviewCloseButton").is_none());assert_eq!(saved.get("smartHide"), Some(&serde_json::json!(false)));Ok(())}@@ -707,11 +735,17 @@ mod tests {}#[test]- fn load_should_fill_missing_fields_with_defaults() {+ fn load_fills_missing_fields_and_preserves_legacy_visibility() {let path = scratch("partial");save(&path, &Config::default()).ok();fs::write(&path, "{}").ok();- assert_eq!(load(&path).ok(), Some(Some(Config::default())));+ assert_eq!(+ load(&path).ok(),+ Some(Some(Config {+ smart_hide: false,+ ..Config::default()+ }))+ );}#[test]diff --git a/crates/muelle-core/src/preview.rs b/crates/muelle-core/src/preview.rsindex ae09795..e178aee 100644--- a/crates/muelle-core/src/preview.rs+++ b/crates/muelle-core/src/preview.rs@@ -68,16 +68,14 @@ pub fn contains(rect: Rect, point: Point) -> bool {&& point.y < rect.y + rect.height}-/// Hit-tests a list of preview card rects against a point.-/// If `show_close` is true, close button hit targets take precedence over card bodies.+/// Hit-tests a list of preview card rects against a point. Close button hit+/// targets take precedence over card bodies.#[must_use]-pub fn hit_test_cards(cards: &[Rect], scale: f32, show_close: bool, point: Point) -> CardHit {- if show_close {- for (i, card) in cards.iter().enumerate() {- let bounds = close_button_bounds(*card, scale);- if contains(bounds.hit, point) {- return CardHit::Close(i);- }+pub fn hit_test_cards(cards: &[Rect], scale: f32, point: Point) -> CardHit {+ for (i, card) in cards.iter().enumerate() {+ let bounds = close_button_bounds(*card, scale);+ if contains(bounds.hit, point) {+ return CardHit::Close(i);}}for (i, card) in cards.iter().enumerate() {@@ -182,30 +180,21 @@ mod tests {x: bounds.hit.x + bounds.hit.width / 2.0,y: bounds.hit.y + bounds.hit.height / 2.0,};- assert_eq!(- hit_test_cards(&cards, 1.0, true, close_pt),- CardHit::Close(0)- );-- // When show_close is false, the same point hits the card body- assert_eq!(- hit_test_cards(&cards, 1.0, false, close_pt),- CardHit::Card(0)- );+ assert_eq!(hit_test_cards(&cards, 1.0, close_pt), CardHit::Close(0));// Point inside card but outside close buttonlet body_pt = Point {x: card.x + card.width / 2.0,y: card.y + card.height / 2.0,};- assert_eq!(hit_test_cards(&cards, 1.0, true, body_pt), CardHit::Card(0));+ assert_eq!(hit_test_cards(&cards, 1.0, body_pt), CardHit::Card(0));// Point outside cardlet outside_pt = Point {x: card.x - 10.0,y: card.y - 10.0,};- assert_eq!(hit_test_cards(&cards, 1.0, true, outside_pt), CardHit::None);+ assert_eq!(hit_test_cards(&cards, 1.0, outside_pt), CardHit::None);}#[test]diff --git a/crates/muelle-shell/src/launcher.rs b/crates/muelle-shell/src/launcher.rsindex cb02d63..de9beb8 100644--- a/crates/muelle-shell/src/launcher.rs+++ b/crates/muelle-shell/src/launcher.rs@@ -21,8 +21,8 @@ use windows::{Shell::{SEE_MASK_FLAG_NO_UI, SEE_MASK_NOASYNC, SHELLEXECUTEINFOW, ShellExecuteExW},WindowsAndMessaging::{ASFW_ANY, AllowSetForegroundWindow, FindWindowW, GWL_EXSTYLE, GetForegroundWindow,- GetWindowLongW, GetWindowRect, GetWindowThreadProcessId, IsIconic, IsWindow,- IsWindowVisible, PostMessageW, SMTO_ABORTIFHUNG, SW_MINIMIZE, SW_RESTORE,+ GetShellWindow, GetWindowLongW, GetWindowRect, GetWindowThreadProcessId, IsIconic,+ IsWindow, IsWindowVisible, PostMessageW, SMTO_ABORTIFHUNG, SW_MINIMIZE, SW_RESTORE,SW_SHOWNORMAL, SWP_ASYNCWINDOWPOS, SWP_NOACTIVATE, SWP_NOMOVE, SWP_NOOWNERZORDER,SWP_NOSIZE, SWP_NOZORDER, SendMessageTimeoutW, SetForegroundWindow, SetWindowPos,ShowWindowAsync, SwitchToThisWindow, WM_CLOSE, WM_NULL, WS_EX_TOPMOST,@@ -277,6 +277,9 @@ pub fn toggle_hidden_icons(anchor: (i32, i32)) {// The press itself already dismissed it.return;}+ // Win+B gives the hidden taskbar the focus on purpose: the dock must+ // leave it there until Enter has opened the flyout.+ OPENING_HIDDEN_ICONS.store(true, Ordering::Relaxed);tap(&[VK_LWIN, VK_B]);// The rest waits on its own short-lived thread so the dock never sleeps.std::thread::spawn(move || {@@ -289,9 +292,41 @@ pub fn toggle_hidden_icons(anchor: (i32, i32)) {}std::thread::sleep(Duration::from_millis(10));}+ OPENING_HIDDEN_ICONS.store(false, Ordering::Relaxed);});}+/// From Win+B until the hidden-icons flyout has had time to open.+static OPENING_HIDDEN_ICONS: AtomicBool = AtomicBool::new(false);++/// Whether the taskbar has the focus because Muelle is opening its+/// hidden-icons flyout (see `toggle_hidden_icons`).+#[must_use]+pub fn opening_hidden_icons() -> bool {+ OPENING_HIDDEN_ICONS.load(Ordering::Relaxed)+}++/// Gives the focus to the first of `windows` (front to back) that is on+/// screen, or to the desktop when none is, as a click on it would.+pub fn focus_front_or_desktop(windows: &[isize]) {+ // SAFETY: Read-only checks and one focus request; they have no effect on+ // a window that is gone, or when Windows refuses the request.+ unsafe {+ let front = windows+ .iter()+ .map(|&raw| HWND(raw as *mut _))+ .find(|&hwnd| {+ IsWindowVisible(hwnd).as_bool()+ && !IsIconic(hwnd).as_bool()+ && !crate::tracker::is_cloaked(hwnd)+ })+ .unwrap_or_else(|| GetShellWindow());+ if !front.is_invalid() {+ bring_to_front(front);+ }+ }+}+/// Whether the hidden-icons flyout was open when the mouse button went down/// on the menu bar: if that press dismissed it, the click must not reopen it.static OVERFLOW_OPEN_AT_PRESS: AtomicBool = AtomicBool::new(false);diff --git a/crates/muelle-shell/src/taskbar.rs b/crates/muelle-shell/src/taskbar.rsindex 2aa0faf..ba1be42 100644--- a/crates/muelle-shell/src/taskbar.rs+++ b/crates/muelle-shell/src/taskbar.rs@@ -113,6 +113,15 @@ pub fn give_back() {let _ = fs::remove_file(file);}+/// Whether `hwnd` is a taskbar Muelle has hidden. Windows still gives it the+/// foreground when nothing else can take it (the last window closes, a+/// full-screen app ends), and its focused "^" button then shows its tooltip,+/// "Show hidden icons", in a popup of its own over the desktop (issue #48).+#[must_use]+pub fn is_hidden(hwnd: HWND) -> bool {+ taskbars().contains(&hwnd) && is_ghosted(hwnd)+}+fn taskbars() -> Vec<HWND> {let mut found = Vec::new();// SAFETY: Read-only calls with valid static strings.