A lightweight, macOS-style dock for Windows 11, with glass visuals, smooth magnification, and Genie effect.
feat(bluetooth): implement Bluetooth status monitoring and remove legacy settings
CristianOlivera16be18cdb5631
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 13c8b5a..256c5ce 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,9 @@ copia la sección de la versión que se publica a la release de GitHub.### English+- Bluetooth now follows Windows automatically: its menu-bar icon appears only+ while a Bluetooth radio is on. Removed the duplicate Settings toggle and+ retired saved overrides. State/hotplug events update the icon without polling.- Fixed window previews disappearing while moving diagonally from the Dock icontowards an outer card. The handoff area follows the picker width on every Dockedge and delayed mouse-leave messages no longer cancel a newer hover.@@ -25,6 +28,10 @@ copia la sección de la versión que se publica a la release de GitHub.### Español+- Bluetooth sigue automáticamente a Windows: su icono aparece solo cuando hay+ una radio Bluetooth encendida. Retirados el interruptor duplicado de Ajustes+ y las preferencias antiguas. Los eventos de estado/hardware actualizan el+ indicador sin sondeo periódico.- Corregido el cierre de previsualizaciones al ir en diagonal desde el iconohacia una miniatura lateral. La zona de paso se adapta al selector en cadaborde del Dock; las salidas tardías del ratón no cancelan un hover más reciente.diff --git a/apps/dock/Cargo.toml b/apps/dock/Cargo.tomlindex 1225e1a..af09662 100644--- a/apps/dock/Cargo.toml+++ b/apps/dock/Cargo.toml@@ -29,6 +29,7 @@ windows-future = "0.3"windows-numerics.workspace = truewindows = { workspace = true, features = ["Devices_Enumeration",+ "Devices_Radios","Devices_HumanInterfaceDevice","Foundation","Graphics",diff --git a/apps/dock/src/app.rs b/apps/dock/src/app.rsindex 0e90fe3..c59ab39 100644--- a/apps/dock/src/app.rs+++ b/apps/dock/src/app.rs@@ -4487,7 +4487,6 @@ impl App {search: self.config.menu_bar_search,task_view: self.config.menu_bar_task_view,widgets: self.config.menu_bar_widgets,- bluetooth: self.config.menu_bar_bluetooth,battery_percent: self.config.menu_bar_battery_percent,island_style: self.config.menu_bar_island_style,};@@ -5054,6 +5053,13 @@ pub fn menu_bar_audio_changed() {});}+pub fn menu_bar_bluetooth_changed() {+ with_app("Bluetooth", |app| match &mut app.menubar {+ Some(bar) => bar.bluetooth_changed(&app.gfx),+ None => Ok(()),+ });+}+pub fn menu_bar_accessories_changed() {with_app("accesorios", |app| match &mut app.menubar {Some(bar) => bar.accessories_changed(&app.gfx),diff --git a/apps/dock/src/bluetooth.rs b/apps/dock/src/bluetooth.rsnew file mode 100644index 0000000..43ff586--- /dev/null+++ b/apps/dock/src/bluetooth.rs@@ -0,0 +1,423 @@+//! Read-only radio status. Windows supplies state and hotplug events; there is+//! no polling thread, permission prompt or attempt to change the system radio.++use std::{+ collections::HashMap,+ sync::{+ Arc, Mutex, Weak,+ atomic::{AtomicBool, AtomicIsize, Ordering},+ },+};+use windows::{+ Devices::{+ Enumeration::{DeviceInformation, DeviceInformationUpdate, DeviceWatcher},+ Radios::{Radio, RadioKind, RadioState},+ },+ Foundation::TypedEventHandler,+ Win32::{+ Foundation::{HWND, LPARAM, WPARAM},+ UI::WindowsAndMessaging::PostMessageW,+ },+ core::{Ref, Result},+};+use windows_future::{AsyncOperationCompletedHandler, IAsyncOperation};++struct Subscription {+ radio: Radio,+ token: i64,+}++impl Drop for Subscription {+ fn drop(&mut self) {+ let _ = self.radio.RemoveStateChanged(self.token);+ }+}++struct Device {+ on: AtomicBool,+ pending: Mutex<Option<IAsyncOperation<Radio>>>,+ subscription: Mutex<Option<Subscription>>,+ owner: Weak<Shared>,+}++impl Device {+ fn refresh(&self, radio: &Radio) {+ // Serialize reads with the initial reading, so an earlier reading+ // cannot overwrite a newer state event. The UI reads only the atomic.+ if let Ok(_guard) = self.subscription.lock() {+ self.on.store(+ radio.State().is_ok_and(|state| state == RadioState::On),+ Ordering::Release,+ );+ }+ if let Some(owner) = self.owner.upgrade() {+ owner.publish();+ }+ }++ fn connect(self: &Arc<Self>, radio: Radio) -> Result<()> {+ if radio.Kind()? != RadioKind::Bluetooth {+ return Ok(());+ }+ let weak = Arc::downgrade(self);+ let token = radio.StateChanged(&TypedEventHandler::new(move |radio: Ref<Radio>, _| {+ if let (Some(device), Some(radio)) = (weak.upgrade(), radio.as_ref()) {+ device.refresh(radio);+ }+ Ok(())+ }))?;+ let subscription = Subscription {+ radio: radio.clone(),+ token,+ };+ let previous = self+ .subscription+ .lock()+ .ok()+ .and_then(|mut slot| slot.replace(subscription));+ drop(previous);+ self.refresh(&radio);+ Ok(())+ }+}++impl Drop for Device {+ fn drop(&mut self) {+ if let Ok(pending) = self.pending.get_mut()+ && let Some(operation) = pending.take()+ {+ let _ = operation.Cancel();+ }+ }+}++struct Shared {+ window: AtomicIsize,+ message: u32,+ on: AtomicBool,+ devices: Mutex<HashMap<String, Arc<Device>>>,+}++impl Shared {+ fn publish(&self) {+ let Ok(devices) = self.devices.lock() else {+ return;+ };+ let on = devices+ .values()+ .any(|device| device.on.load(Ordering::Acquire));+ // Compare under the same lock as hotplug aggregation; two callbacks+ // cannot publish their snapshots in reverse order.+ if self.on.swap(on, Ordering::AcqRel) != on {+ let window = self.window.load(Ordering::Acquire);+ if window != 0 {+ unsafe {+ let _ = PostMessageW(+ Some(HWND(window as *mut _)),+ self.message,+ WPARAM(0),+ LPARAM(0),+ );+ }+ }+ }+ }++ fn added(self: &Arc<Self>, info: &DeviceInformation) -> Result<()> {+ let id = info.Id()?;+ let device = Arc::new(Device {+ on: AtomicBool::new(false),+ pending: Mutex::new(None),+ subscription: Mutex::new(None),+ owner: Arc::downgrade(self),+ });+ let previous = match self.devices.lock() {+ Ok(mut devices) => {+ if self.window.load(Ordering::Acquire) == 0 {+ return Ok(());+ }+ devices.insert(id.to_string_lossy(), device.clone())+ }+ Err(_) => return Ok(()),+ };+ drop(previous); // Unsubscribe outside the map lock.+ self.publish();+ let operation = Radio::FromIdAsync(&id)?;+ if let Ok(mut pending) = device.pending.lock() {+ *pending = Some(operation.clone());+ }+ let weak = Arc::downgrade(&device);+ let result =+ operation.SetCompleted(&AsyncOperationCompletedHandler::new(move |operation, _| {+ if let Some(device) = weak.upgrade() {+ if let Some(operation) = operation.as_ref()+ && let Ok(radio) = operation.GetResults()+ {+ let _ = device.connect(radio);+ }+ if let Ok(mut pending) = device.pending.lock() {+ pending.take();+ }+ }+ Ok(())+ }));+ if result.is_err()+ && let Ok(mut pending) = device.pending.lock()+ && let Some(operation) = pending.take()+ {+ let _ = operation.Cancel();+ }+ result+ }++ fn removed(&self, id: &str) {+ let removed = self+ .devices+ .lock()+ .ok()+ .and_then(|mut devices| devices.remove(id));+ drop(removed);+ self.publish();+ }+}++pub struct Monitor {+ shared: Arc<Shared>,+ watcher: DeviceWatcher,+ added: Option<i64>,+ removed: Option<i64>,+}++impl Monitor {+ pub fn new(window: isize, message: u32) -> Result<Self> {+ let mut monitor = Self {+ shared: Arc::new(Shared {+ window: AtomicIsize::new(window),+ message,+ on: AtomicBool::new(false),+ devices: Mutex::new(HashMap::new()),+ }),+ watcher: DeviceInformation::CreateWatcherAqsFilter(&Radio::GetDeviceSelector()?)?,+ added: None,+ removed: None,+ };+ let weak = Arc::downgrade(&monitor.shared);+ monitor.added = Some(monitor.watcher.Added(&TypedEventHandler::new(+ move |_, info: Ref<DeviceInformation>| {+ if let (Some(shared), Some(info)) = (weak.upgrade(), info.as_ref()) {+ let _ = shared.added(info);+ }+ Ok(())+ },+ ))?);+ let weak = Arc::downgrade(&monitor.shared);+ monitor.removed = Some(monitor.watcher.Removed(&TypedEventHandler::new(+ move |_, info: Ref<DeviceInformationUpdate>| {+ if let (Some(shared), Some(info)) = (weak.upgrade(), info.as_ref())+ && let Ok(id) = info.Id()+ {+ shared.removed(&id.to_string_lossy());+ }+ Ok(())+ },+ ))?);+ monitor.watcher.Start()?;+ Ok(monitor)+ }++ pub fn is_on(&self) -> bool {+ self.shared.on.load(Ordering::Acquire)+ }+}++impl Drop for Monitor {+ fn drop(&mut self) {+ // Serialize shutdown with publish(), so an in-flight callback cannot+ // post to this HWND after its owner goes away and Windows reuses it.+ let devices = self.shared.devices.lock().ok().map(|mut devices| {+ self.shared.window.store(0, Ordering::Release);+ self.shared.on.store(false, Ordering::Release);+ std::mem::take(&mut *devices)+ });+ self.shared.window.store(0, Ordering::Release);+ if let Some(token) = self.added.take() {+ let _ = self.watcher.RemoveAdded(token);+ }+ if let Some(token) = self.removed.take() {+ let _ = self.watcher.RemoveRemoved(token);+ }+ let _ = self.watcher.Stop();+ drop(devices);+ }+}++#[cfg(test)]+mod tests {+ use super::*;+ use anyhow::Context;++ fn shared() -> Arc<Shared> {+ Arc::new(Shared {+ window: AtomicIsize::new(0),+ message: 0,+ on: AtomicBool::new(false),+ devices: Mutex::new(HashMap::new()),+ })+ }++ fn device(owner: &Arc<Shared>, on: bool) -> Arc<Device> {+ Arc::new(Device {+ on: AtomicBool::new(on),+ pending: Mutex::new(None),+ subscription: Mutex::new(None),+ owner: Arc::downgrade(owner),+ })+ }++ #[test]+ fn enabled_adapters_are_aggregated_and_removing_the_last_one_hides_bluetooth()+ -> anyhow::Result<()> {+ let shared = shared();+ assert!(!shared.on.load(Ordering::Acquire));+ let first = device(&shared, true);+ let second = device(&shared, true);+ shared+ .devices+ .lock()+ .map_err(|_| anyhow::anyhow!("poisoned device map"))?+ .extend([("internal".into(), first.clone()), ("usb".into(), second)]);+ shared.publish();+ assert!(shared.on.load(Ordering::Acquire));+ first.on.store(false, Ordering::Release);+ shared.publish();+ assert!(shared.on.load(Ordering::Acquire));+ shared.removed("usb");+ assert!(!shared.on.load(Ordering::Acquire));+ Ok(())+ }++ #[test]+ fn an_old_removed_adapter_cannot_override_its_replacement() -> anyhow::Result<()> {+ let shared = shared();+ let old = device(&shared, true);+ let replacement = device(&shared, false);+ shared+ .devices+ .lock()+ .map_err(|_| anyhow::anyhow!("poisoned device map"))?+ .insert("usb".into(), replacement);+ old.on.store(true, Ordering::Release); // A callback already in flight.+ old.owner.upgrade().context("live monitor")?.publish();+ assert!(!shared.on.load(Ordering::Acquire));+ let weak = Arc::downgrade(&old);+ drop(old);+ assert!(+ weak.upgrade().is_none(),+ "callbacks must not retain removed devices"+ );+ Ok(())+ }++ #[test]+ #[ignore = "Read-only Windows radio watcher; does not toggle hardware or request access"]+ fn native_radio_watcher_reads_state_and_releases_subscriptions() -> anyhow::Result<()> {+ use std::time::{Duration, Instant};+ use windows::Devices::Enumeration::DeviceWatcherStatus;+ use windows::Win32::{+ System::WinRT::{RO_INIT_MULTITHREADED, RoInitialize, RoUninitialize},+ UI::WindowsAndMessaging::{CreateWindowExW, DestroyWindow, WM_APP, WS_POPUP},+ };+ use windows::core::w;+ unsafe {+ RoInitialize(RO_INIT_MULTITHREADED)?;+ }+ let result = (|| -> anyhow::Result<()> {+ let window = unsafe {+ CreateWindowExW(+ Default::default(),+ w!("STATIC"),+ w!("Muelle radio test"),+ WS_POPUP,+ -32000,+ -32000,+ 1,+ 1,+ None,+ None,+ None,+ None,+ )?+ };+ struct Window(HWND);+ impl Drop for Window {+ fn drop(&mut self) {+ unsafe {+ let _ = DestroyWindow(self.0);+ }+ }+ }+ let _window = Window(window);+ let monitor = Monitor::new(window.0 as isize, WM_APP + 300)?;+ let deadline = Instant::now() + Duration::from_secs(3);+ loop {+ let complete =+ monitor.watcher.Status()? == DeviceWatcherStatus::EnumerationCompleted;+ let pending = monitor+ .shared+ .devices+ .lock()+ .map_err(|_| anyhow::anyhow!("poisoned device map"))?+ .values()+ .any(|device| {+ device+ .pending+ .lock()+ .map_or(true, |pending| pending.is_some())+ });+ if complete && !pending {+ break;+ }+ anyhow::ensure!(+ Instant::now() < deadline,+ "radio discovery exceeded its test deadline"+ );+ std::thread::sleep(Duration::from_millis(10));+ }+ let shared = monitor.shared.clone();+ let devices = shared+ .devices+ .lock()+ .map_err(|_| anyhow::anyhow!("poisoned device map"))?;+ let mut expected = false;+ let mut tracked = 0;+ for device in devices.values() {+ let subscription = device+ .subscription+ .lock()+ .map_err(|_| anyhow::anyhow!("poisoned radio slot"))?;+ if let Some(subscription) = subscription.as_ref() {+ assert!(subscription.radio.Kind()? == RadioKind::Bluetooth);+ expected |= subscription.radio.State()? == RadioState::On;+ tracked += 1;+ }+ }+ drop(devices);+ assert_eq!(monitor.is_on(), expected);+ eprintln!("Bluetooth radios watched: {tracked}; enabled: {expected}");+ drop(monitor);+ assert_eq!(shared.window.load(Ordering::Acquire), 0);+ assert!(+ shared+ .devices+ .lock()+ .map_err(|_| anyhow::anyhow!("poisoned device map"))?+ .is_empty()+ );+ Ok(())+ })();+ unsafe {+ RoUninitialize();+ }+ result+ }+}diff --git a/apps/dock/src/main.rs b/apps/dock/src/main.rsindex a3049ef..76fa8e6 100644--- a/apps/dock/src/main.rs+++ b/apps/dock/src/main.rs@@ -14,6 +14,7 @@mod accessories;mod app;mod assets;+mod bluetooth;mod drop;mod edge_watch;mod flight;diff --git a/apps/dock/src/menubar.rs b/apps/dock/src/menubar.rsindex b7f2a29..1e0d403 100644--- a/apps/dock/src/menubar.rs+++ b/apps/dock/src/menubar.rs@@ -70,7 +70,7 @@ use windows::{use windows_numerics::{Vector2, Vector3};use crate::{- accessories, app, edge_watch,+ accessories, app, bluetooth, edge_watch,gfx::{Gfx, Ink, LabelBrush},mascot,media::{self, Control as MediaControl, Track},@@ -92,6 +92,7 @@ const MEDIA_CHANGED: u32 = WM_APP + 28;const VOLUME_CAPTURE_LOST: u32 = WM_APP + 31;const AUDIO_CHANGED: u32 = WM_APP + 32;const AUDIO_TICK: u32 = WM_APP + 33;+const BLUETOOTH_CHANGED: u32 = WM_APP + 34;const VOLUME_TIMER: usize = 4;const PROGRESS_TIMER: usize = 5;const ACCESSORIES_CHANGED: u32 = WM_APP + 30;@@ -181,7 +182,6 @@ pub struct MenuBarWidgets {pub search: Option<bool>,pub task_view: Option<bool>,pub widgets: Option<bool>,- pub bluetooth: bool,pub battery_percent: Option<bool>,pub island_style: IslandStyle,}@@ -192,7 +192,6 @@ impl Default for MenuBarWidgets {search: None,task_view: None,widgets: None,- bluetooth: true,battery_percent: None,island_style: IslandStyle::Notch,}@@ -202,6 +201,7 @@ impl Default for MenuBarWidgets {/// Network, volume and taskbar buttons, read only when Windows reports a change.#[derive(Clone, Copy, PartialEq, Eq)]struct Status {+ bluetooth_on: bool,network: Network,volume: Option<Volume>,buttons: TaskbarButtons,@@ -462,6 +462,7 @@ impl Drop for ExitAnimation {}pub struct MenuBar {+ bluetooth: Option<bluetooth::Monitor>,accessories: Option<accessories::Monitor>,accessories_enabled: bool,accessory_retry_at: Instant,@@ -575,6 +576,7 @@ unsafe extern "system" fn bar_proc(hwnd: HWND, msg: u32, w: WPARAM, l: LPARAM) -REGISTRY_CHANGED => app::menu_bar_registry_changed(),ACCESSORIES_CHANGED => app::menu_bar_accessories_changed(),MEDIA_CHANGED => app::menu_bar_media_changed(),+ BLUETOOTH_CHANGED => app::menu_bar_bluetooth_changed(),AUDIO_CHANGED => {if !AUDIO_TICK_PENDING.swap(true, Ordering::Relaxed) {unsafe {@@ -1150,6 +1152,7 @@ impl MenuBar {exit_animation: None,bounds: RECT::default(),status: Status {+ bluetooth_on: false,network: Network::Offline,volume: None,buttons: TaskbarButtons::default(),@@ -1181,6 +1184,7 @@ impl MenuBar {panel_span: Span::default(),island_hits: Vec::new(),outside_click_hook: None,+ bluetooth: bluetooth::Monitor::new(hwnd.0 as isize, BLUETOOTH_CHANGED).ok(),_network: NetworkWatch::new(hwnd.0 as isize, STATUS_CHANGED),privacy_watch: status::watch_privacy(hwnd.0 as isize, REGISTRY_CHANGED),settings_watch: status::watch_taskbar_settings(hwnd.0 as isize, REGISTRY_CHANGED),@@ -1717,8 +1721,28 @@ impl MenuBar {self.apply_look(gfx, look)}+ pub fn bluetooth_changed(&mut self, gfx: &Gfx) -> Result<()> {+ let on = self+ .bluetooth+ .as_ref()+ .is_some_and(bluetooth::Monitor::is_on);+ self.status.bluetooth_on = on;+ let Some(mut look) = self.look.clone() else {+ return self.refresh(gfx);+ };+ if look.status.bluetooth_on == on {+ return Ok(());+ }+ look.status.bluetooth_on = on;+ self.apply_look(gfx, look)+ }+fn update_status(&mut self) {self.status = Status {+ bluetooth_on: self+ .bluetooth+ .as_ref()+ .is_some_and(bluetooth::Monitor::is_on),network: status::network(),volume: self.audio.as_mut().and_then(AudioWatch::volume),buttons: status::taskbar_buttons(),@@ -2094,12 +2118,11 @@ impl MenuBar {.widgets.battery_percent.unwrap_or(status.battery_percentage);- let show_bluetooth = look.widgets.bluetooth;if show_search {items.push((symbol(&[(glyph::SEARCH, 1.0)])?, Action::Search));}- if show_bluetooth {+ if status.bluetooth_on {items.push((symbol(&[(glyph::BLUETOOTH, 1.0)])?, Action::Bluetooth));}match status.network {@@ -4026,6 +4049,7 @@ fn draw_bubble_player(impl Drop for MenuBar {fn drop(&mut self) {+ self.bluetooth = None;self.accessories = None;self.exit_animation = None;self.media = None;@@ -4050,6 +4074,57 @@ impl Drop for MenuBar {mod island_tests {use super::*;+ #[test]+ #[ignore = "Hidden compositor fixture; synthetic Bluetooth states, no hardware changes"]+ fn native_bluetooth_indicator_appears_only_for_an_enabled_system_radio() -> 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)?;+ bar.bluetooth = None;+ let mut look = bar.look.clone().context("initial look")?;+ look.screen = RECT {+ left: 0,+ top: 0,+ right: 1920,+ bottom: 1080,+ };+ for on in [false, true, false] {+ look.status.bluetooth_on = on;+ bar.status.bluetooth_on = on;+ bar.apply_look(&gfx, look.clone())?;+ assert_eq!(+ bar.zones+ .iter()+ .filter(|(_, _, action)| *action == Action::Bluetooth)+ .count(),+ usize::from(on)+ );+ }+ // The native event handler updates the cached Look instead of running+ // provider/process scans or re-reading unrelated Windows preferences.+ look.status.bluetooth_on = true;+ bar.apply_look(&gfx, look)?;+ bar.bluetooth_changed(&gfx)?;+ assert!(+ !bar.zones+ .iter()+ .any(|(_, _, action)| *action == Action::Bluetooth)+ );+ 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/settings/src/App.tsx b/apps/settings/src/App.tsxindex f0c8872..ac4ae9f 100644--- a/apps/settings/src/App.tsx+++ b/apps/settings/src/App.tsx@@ -613,13 +613,6 @@ export function App() {</Card>{config.menuBar && (<Card title={t.menuBarItems}>- <Row icon={<SettingIcon name="bluetooth" />} label={t.menuBarBluetooth} hint={t.menuBarBluetoothHint}>- <Toggle- label={t.menuBarBluetooth}- checked={config.menuBarBluetooth}- onChange={(menuBarBluetooth) => update({ menuBarBluetooth })}- />- </Row><Row icon={<SettingIcon name="battery" />} label={t.menuBarBatteryPercent} hint={t.menuBarBatteryPercentHint}><Togglelabel={t.menuBarBatteryPercent}diff --git a/apps/settings/src/config.ts b/apps/settings/src/config.tsindex 9627727..19c857e 100644--- a/apps/settings/src/config.ts+++ b/apps/settings/src/config.ts@@ -39,7 +39,6 @@ export interface Config {menuBarSearch: boolean | null;menuBarTaskView: boolean | null;menuBarWidgets: boolean | null;- menuBarBluetooth: boolean;menuBarBatteryPercent: boolean | null;showIndicators: boolean;showRecents: boolean;diff --git a/apps/settings/src/i18n/en.json b/apps/settings/src/i18n/en.jsonindex cc0daad..f8b8df5 100644--- a/apps/settings/src/i18n/en.json+++ b/apps/settings/src/i18n/en.json@@ -56,8 +56,6 @@"accessoryBatteryHint": "Supported mice and headsets. No device queries while off.","aiUsageHint": "Uses your existing sessions; checks every 5 min. Never saves credentials.","menuBarItems": "Status items",- "menuBarBluetooth": "Bluetooth",- "menuBarBluetoothHint": "Show Bluetooth status and open settings beside Wi-Fi.","menuBarBatteryPercent": "Show battery percentage","menuBarBatteryPercentHint": "Display the charge percentage next to the battery icon.","menuBarSearch": "Search button",diff --git a/apps/settings/src/i18n/es.json b/apps/settings/src/i18n/es.jsonindex 85513a2..72a2238 100644--- a/apps/settings/src/i18n/es.json+++ b/apps/settings/src/i18n/es.json@@ -56,8 +56,6 @@"accessoryBatteryHint": "Ratones y auriculares compatibles. Apagado, no los consulta.","aiUsageHint": "Usa tus sesiones abiertas; consulta cada 5 min. No guarda credenciales.","menuBarItems": "Elementos de estado",- "menuBarBluetooth": "Bluetooth",- "menuBarBluetoothHint": "Muestra el estado de Bluetooth y abre sus ajustes junto al Wi-Fi.","menuBarBatteryPercent": "Mostrar porcentaje de batería","menuBarBatteryPercentHint": "Muestra el nivel de carga junto al icono de la batería.","menuBarSearch": "Botón de búsqueda",diff --git a/apps/settings/src/i18n/fr.json b/apps/settings/src/i18n/fr.jsonindex f70a842..cc4b91e 100644--- a/apps/settings/src/i18n/fr.json+++ b/apps/settings/src/i18n/fr.json@@ -56,8 +56,6 @@"accessoryBatteryHint": "Souris et casques compatibles. Aucune interrogation si désactivé.","aiUsageHint": "Utilise vos sessions existantes ; vérifie toutes les 5 min. Aucun identifiant enregistré.","menuBarItems": "Éléments d'état",- "menuBarBluetooth": "Bluetooth",- "menuBarBluetoothHint": "Affiche le statut Bluetooth et ouvre ses paramètres à côté du Wi-Fi.","menuBarBatteryPercent": "Afficher le pourcentage de batterie","menuBarBatteryPercentHint": "Affiche le pourcentage à côté de l'icône de batterie.","menuBarSearch": "Bouton de recherche",diff --git a/apps/settings/src/visuals.tsx b/apps/settings/src/visuals.tsxindex 0951585..774ad20 100644--- a/apps/settings/src/visuals.tsx+++ b/apps/settings/src/visuals.tsx@@ -17,7 +17,6 @@ const PATHS = {music: <><path d="M9 17V5l12-2v12M9 9l12-2" /><ellipse cx="6" cy="18" rx="3" ry="2" /><ellipse cx="18" cy="16" rx="3" ry="2" /></>,ai: <><path d="m12 2 2.6 7.4L22 12l-7.4 2.6L12 22l-2.6-7.4L2 12l7.4-2.6z" /></>,headphones: <><path d="M4 14v-3a8 8 0 0 1 16 0v3" /><rect x="3" y="12" width="4" height="8" rx="2" /><rect x="17" y="12" width="4" height="8" rx="2" /></>,- bluetooth: <path d="m7 7 10 10-5 4V3l5 4L7 17" />,battery: <><rect x="2" y="6" width="18" height="12" rx="2" /><path d="M23 10v4M6 10v4m4-4v4m4-4v4" /></>,search: <><circle cx="10" cy="10" r="7" /><path d="m15 15 6 6" /></>,widgets: <><rect x="3" y="3" width="7" height="18" rx="2" /><rect x="14" y="3" width="7" height="7" rx="2" /><rect x="14" y="14" width="7" height="7" rx="2" /></>,diff --git a/apps/settings/tests/app.test.mjs b/apps/settings/tests/app.test.mjsindex ba5dec3..88479b2 100644--- a/apps/settings/tests/app.test.mjs+++ b/apps/settings/tests/app.test.mjs@@ -129,6 +129,14 @@ test("each section renders only its own controls, in every language and visibili}});+test("Bluetooth has no duplicate setting even with an old saved visibility override", () => {+ for (const language of Object.keys(texts)) for (const menuBarBluetooth of [false, true]) {+ const view = fixture("menubar", { language, menuBar: true, menuBarBluetooth });+ assert.doesNotMatch(renderToStaticMarkup(view.body()), /Bluetooth/i);+ assert.ok([...elements(view.body())].some((node) => node.props.title === texts[language].menuBarItems));+ }+});+test("other workspaces are opt-in and save without changing other window preferences", async () => {const view = fixture("windows", { showOtherWorkspaces: undefined });const checked = () => [...elements(view.body())].find((node) =>diff --git a/crates/muelle-config/src/lib.rs b/crates/muelle-config/src/lib.rsindex 3d4225f..703a482 100644--- a/crates/muelle-config/src/lib.rs+++ b/crates/muelle-config/src/lib.rs@@ -102,8 +102,6 @@ pub struct Config {pub menu_bar_task_view: Option<bool>,/// Show Widgets button in the menu bar (`None` follows Windows taskbar setting).pub menu_bar_widgets: Option<bool>,- /// Show Bluetooth button in the menu bar.- pub menu_bar_bluetooth: bool,/// Show battery percentage in the menu bar (`None` follows Windows setting).pub menu_bar_battery_percent: Option<bool>,/// The dot under apps that have windows open.@@ -320,7 +318,6 @@ impl Default for Config {menu_bar_search: None,menu_bar_task_view: None,menu_bar_widgets: Some(false),- menu_bar_bluetooth: false,menu_bar_battery_percent: None,show_indicators: true,show_recents: true,@@ -467,6 +464,23 @@ fn write_config(path: &Path, config: &Config) -> Result<(), ConfigError> {mod tests {use super::*;+ #[test]+ fn retired_bluetooth_visibility_does_not_override_system_status()+ -> Result<(), serde_json::Error> {+ for old in [false, true] {+ let config: Config = serde_json::from_value(+ serde_json::json!({"menuBarBluetooth": old, "showStart": false}),+ )?;+ assert!(!config.show_start);+ assert!(+ serde_json::to_value(config)?+ .get("menuBarBluetooth")+ .is_none()+ );+ }+ Ok(())+ }+#[test]fn other_workspaces_are_opt_in_and_preserved_when_saving() -> Result<(), serde_json::Error> {let legacy: Config = serde_json::from_str("{}")?;