Skip to content

A lightweight, macOS-style dock for Windows 11, with glass visuals, smooth magnification, and Genie effect.

feat: add power saver battery indicator, wifi warning, bluetooth widget, and menubar controls

Saivarshith Mitukula35942bc57fba
diff --git a/apps/dock/src/app.rs b/apps/dock/src/app.rs
index dd88970..aab2697 100644
--- a/apps/dock/src/app.rs
+++ b/apps/dock/src/app.rs
@@ -100,7 +100,7 @@ use crate::{
group_view::{DragGhost, GroupItem, GroupView, Placement, Released},
mascot,
menu::{self, MenuItem},
- menubar::MenuBar,
+ menubar::{self, MenuBar, MenuBarWidgets},
multi_window_view::MultiWindowView,
scene::{Drag, Frame, Scene, SceneInput, SlotContent, Theme},
shell_work::{self, Action as ShellAction},
@@ -3773,6 +3773,13 @@ impl App {
/// shows it again when it no longer does.
/// Creates or removes the menu bar to match the settings.
fn apply_menu_bar_setting(&mut self) {
+ let widgets = MenuBarWidgets {
+ 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,
+ };
if !self.config.menu_bar {
self.menubar = None;
} else if self.menubar.is_none() {
@@ -3780,6 +3787,7 @@ impl App {
&self.gfx,
self.config.ai_usage,
self.config.menu_bar_auto_hide,
+ widgets,
)
.inspect_err(|error| eprintln!("muelle: barra superior: {error:#}"))
.ok();
@@ -3788,6 +3796,7 @@ impl App {
let applied = bar
.set_auto_hide(self.config.menu_bar_auto_hide)
.and_then(|()| bar.set_usage_enabled(&self.gfx, self.config.ai_usage))
+ .and_then(|()| bar.set_widgets(&self.gfx, widgets))
.and_then(|()| {
let covered = primary_monitor()
.is_some_and(|monitor| tracker::foreground_is_fullscreen(monitor.screen));
diff --git a/apps/dock/src/gfx.rs b/apps/dock/src/gfx.rs
index 4378d85..8438b89 100644
--- a/apps/dock/src/gfx.rs
+++ b/apps/dock/src/gfx.rs
@@ -979,6 +979,99 @@ impl Gfx {
})
}
+ /// Wi-Fi icon filled to `bars` with faint fan background.
+ /// If `has_internet` is false, an exclamation mark is drawn beside the Wi-Fi icon.
+ pub fn wifi_brush(
+ &self,
+ bars: u8,
+ has_internet: bool,
+ scale: f32,
+ ink: Ink,
+ ) -> Result<LabelBrush> {
+ let icon_side = (18.0 * scale).round();
+ let width = if has_internet {
+ icon_side
+ } else {
+ (icon_side + 7.0 * scale).round()
+ };
+ let height = icon_side;
+ // SAFETY: The format lives for the drawing below.
+ let format = unsafe {
+ let format = self.dwrite.CreateTextFormat(
+ icon_font(),
+ None,
+ DWRITE_FONT_WEIGHT_NORMAL,
+ DWRITE_FONT_STYLE_NORMAL,
+ DWRITE_FONT_STRETCH_NORMAL,
+ 15.0 * scale,
+ w!(""),
+ )?;
+ format.SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER)?;
+ format.SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER)?;
+ format
+ };
+ let brush = self.draw(width as u32, height as u32, |dc| {
+ let icon_area = D2D_RECT_F {
+ left: 0.0,
+ top: 0.0,
+ right: icon_side,
+ bottom: height,
+ };
+ // SAFETY: The brush, format and text live for each drawing call.
+ unsafe {
+ let ink_brush = dc.CreateSolidColorBrush(&ink.color(), None)?;
+ let wifi_glyph = crate::menubar::glyph::WIFI[usize::from(bars.clamp(1, 4)) - 1];
+ for &(glyph, opacity) in &[
+ (crate::menubar::glyph::WIFI_FULL, 0.3f32),
+ (wifi_glyph, 1.0f32),
+ ] {
+ let mut units = [0u16; 2];
+ let text = glyph.encode_utf16(&mut units);
+ ink_brush.SetOpacity(opacity);
+ dc.DrawText(
+ text,
+ &format,
+ &icon_area,
+ &ink_brush,
+ D2D1_DRAW_TEXT_OPTIONS_NONE,
+ DWRITE_MEASURING_MODE_NATURAL,
+ );
+ }
+ if !has_internet {
+ let warn_color = rgb(0.98, 0.60, 0.0, 1.0);
+ let warn_brush = dc.CreateSolidColorBrush(&warn_color, None)?;
+ let ex_x = icon_side + 2.5 * scale;
+ let stroke = (1.8 * scale).max(1.0);
+ let bar_top = height * 0.22;
+ let bar_bottom = height * 0.58;
+ dc.DrawLine(
+ Vector2 { X: ex_x, Y: bar_top },
+ Vector2 { X: ex_x, Y: bar_bottom },
+ &warn_brush,
+ stroke,
+ None,
+ );
+ let dot_radius = (stroke * 0.55).max(1.0);
+ let dot_y = height * 0.74;
+ dc.FillEllipse(
+ &D2D1_ELLIPSE {
+ point: Vector2 { X: ex_x, Y: dot_y },
+ radiusX: dot_radius,
+ radiusY: dot_radius,
+ },
+ &warn_brush,
+ );
+ }
+ }
+ Ok(())
+ })?;
+ Ok(LabelBrush {
+ brush,
+ width,
+ height,
+ })
+ }
+
/// Two switches, one on and one off: the control center glyph.
pub fn control_center_brush(&self, scale: f32, ink: Ink) -> Result<LabelBrush> {
let (width, height) = ((19.0 * scale).round(), (16.0 * scale).round());
@@ -1024,11 +1117,12 @@ impl Gfx {
})
}
- /// Battery outline filled to `percent`, green while charging.
+ /// Battery outline filled to `percent`, green while charging, orange on saver.
pub fn battery_brush(
&self,
percent: u8,
charging: bool,
+ saver: bool,
scale: f32,
ink: Ink,
) -> Result<LabelBrush> {
@@ -1039,6 +1133,8 @@ impl Gfx {
let body_right = width - cap - stroke;
let level = if charging {
rgb(0.20, 0.78, 0.35, 1.0)
+ } else if saver {
+ rgb(0.98, 0.60, 0.0, 1.0)
} else if percent <= 20 {
rgb(1.0, 0.27, 0.23, 1.0)
} else {
diff --git a/apps/dock/src/menubar.rs b/apps/dock/src/menubar.rs
index 977a704..54bce5a 100644
--- a/apps/dock/src/menubar.rs
+++ b/apps/dock/src/menubar.rs
@@ -126,7 +126,7 @@ static PANEL_BOTTOM: AtomicI32 = AtomicI32::new(0);
/// The hook exists only while the island is expanded.
static ISLAND_HOOK_WINDOW: AtomicIsize = AtomicIsize::new(0);
/// Segoe Fluent Icons code points.
-mod glyph {
+pub(crate) mod glyph {
pub const WIFI: [char; 4] = ['\u{E872}', '\u{E873}', '\u{E874}', '\u{E701}'];
pub const WIFI_FULL: char = '\u{E701}';
pub const ETHERNET: char = '\u{E839}';
@@ -142,6 +142,7 @@ mod glyph {
pub const CAMERA: char = '\u{E722}';
pub const MOUSE: char = '\u{E962}';
pub const HEADSET: char = '\u{E95B}';
+ pub const BLUETOOTH: char = '\u{E702}';
}
#[derive(Clone, Copy, PartialEq, Eq)]
@@ -157,6 +158,28 @@ enum Action {
InputLanguage,
Microphone,
Camera,
+ Bluetooth,
+}
+
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub struct MenuBarWidgets {
+ pub search: Option<bool>,
+ pub task_view: Option<bool>,
+ pub widgets: Option<bool>,
+ pub bluetooth: bool,
+ pub battery_percent: Option<bool>,
+}
+
+impl Default for MenuBarWidgets {
+ fn default() -> Self {
+ Self {
+ search: None,
+ task_view: None,
+ widgets: None,
+ bluetooth: true,
+ battery_percent: None,
+ }
+ }
}
/// Network, volume and taskbar buttons, read only when Windows reports a change.
@@ -185,6 +208,7 @@ struct Look {
input: Option<String>,
battery: Option<Battery>,
status: Status,
+ widgets: MenuBarWidgets,
usage: Snapshot,
usage_enabled: bool,
active_providers: ActiveProviders,
@@ -290,6 +314,7 @@ pub struct MenuBar {
/// Where the full bar goes on screen.
bounds: RECT,
status: Status,
+ widgets: MenuBarWidgets,
usage: Option<UsageMonitor>,
/// Where each provider sits in the closed island, as screen x.
usage_anchors: Vec<(Provider, i32)>,
@@ -825,7 +850,12 @@ fn add_text(
}
impl MenuBar {
- pub fn create(gfx: &Gfx, usage_enabled: bool, auto_hide: bool) -> Result<Self> {
+ pub fn create(
+ gfx: &Gfx,
+ usage_enabled: bool,
+ auto_hide: bool,
+ widgets: MenuBarWidgets,
+ ) -> Result<Self> {
let class = w!("MuelleMenuBar");
// SAFETY: Standard class registration and window creation on the UI
// thread; the window is destroyed in `Drop`.
@@ -899,6 +929,7 @@ impl MenuBar {
privacy: Privacy::default(),
battery_percentage: false,
},
+ widgets,
usage: usage_enabled.then(|| UsageMonitor::new(hwnd.0 as isize, USAGE_CHANGED)),
usage_anchors: Vec::new(),
cue: None,
@@ -997,6 +1028,15 @@ impl MenuBar {
self.refresh(gfx)
}
+ pub fn set_widgets(&mut self, gfx: &Gfx, widgets: MenuBarWidgets) -> Result<()> {
+ if self.widgets == widgets {
+ return Ok(());
+ }
+ self.widgets = widgets;
+ self.refresh(gfx)
+ }
+ }
+
/// The pointer reached the top edge or left the bar.
pub fn hover(&mut self, gfx: &Gfx, inside: bool) -> Result<()> {
if !inside && self.panel.take().is_some() {
@@ -1426,6 +1466,7 @@ impl MenuBar {
Some(Action::Search) => launcher::open_search(),
Some(Action::TaskView) => launcher::open_task_view(),
Some(Action::Widgets) => launcher::open_widgets(),
+ Some(Action::Bluetooth) => launcher::open_bluetooth(),
Some(Action::HiddenIcons) => launcher::toggle_hidden_icons(anchor),
Some(Action::InputLanguage) => {} // Opened outside the app borrow.
// Windows' own pages list which apps use each device.
@@ -1491,6 +1532,7 @@ impl MenuBar {
input: system::input_language(),
battery: system::battery(),
status: self.status,
+ widgets: self.widgets,
usage: self
.usage
.as_ref()
@@ -1649,19 +1691,35 @@ impl MenuBar {
items.push((symbol(&[(glyph, 1.0)])?, action));
}
}
- if status.buttons.search {
+ let show_search = look.widgets.search.unwrap_or(status.buttons.search);
+ let show_task_view = look.widgets.task_view.unwrap_or(status.buttons.task_view);
+ let show_widgets = look.widgets.widgets.unwrap_or(status.buttons.widgets);
+ let show_battery_percentage = look
+ .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));
}
- let network = match status.network {
- // The full fan stays faint behind the bars received, as on a Mac.
- Network::Wifi { bars } => vec![
- (glyph::WIFI_FULL, 0.3),
- (glyph::WIFI[usize::from(bars.clamp(1, 4)) - 1], 1.0),
- ],
- Network::Ethernet => vec![(glyph::ETHERNET, 1.0)],
- Network::Offline => vec![(glyph::OFFLINE, 1.0)],
- };
- items.push((symbol(&network)?, Action::QuickSettings));
+ if show_bluetooth {
+ items.push((symbol(&[(glyph::BLUETOOTH, 1.0)])?, Action::Bluetooth));
+ }
+ match status.network {
+ Network::Wifi { bars, has_internet } => {
+ items.push((
+ gfx.wifi_brush(bars, has_internet, scale, ink)?,
+ Action::QuickSettings,
+ ));
+ }
+ Network::Ethernet => {
+ items.push((symbol(&[(glyph::ETHERNET, 1.0)])?, Action::QuickSettings));
+ }
+ Network::Offline => {
+ items.push((symbol(&[(glyph::OFFLINE, 1.0)])?, Action::QuickSettings));
+ }
+ }
if let Some(volume) = status.volume {
let speaker = if volume.muted {
glyph::MUTE
@@ -1672,14 +1730,14 @@ impl MenuBar {
}
let mut battery_label = None;
if let Some(battery) = look.battery {
- if status.battery_percentage {
+ if show_battery_percentage {
battery_label = Some((
items.len(),
gfx.text_brush(&format!("{}%", battery.percent), scale, false, ink)?,
));
}
items.push((
- gfx.battery_brush(battery.percent, battery.charging, scale, ink)?,
+ gfx.battery_brush(battery.percent, battery.charging, battery.saver, scale, ink)?,
Action::QuickSettings,
));
}
@@ -1704,10 +1762,10 @@ impl MenuBar {
// The notification area (antivirus, OneDrive, apps in the background)
// lives only in the hidden taskbar; this arrow opens its flyout.
items.push((symbol(&[(glyph::HIDDEN_ICONS, 1.0)])?, Action::HiddenIcons));
- if status.buttons.task_view {
+ if show_task_view {
items.push((symbol(&[(glyph::TASK_VIEW, 1.0)])?, Action::TaskView));
}
- if status.buttons.widgets {
+ if show_widgets {
items.push((symbol(&[(glyph::WIDGETS, 1.0)])?, Action::Widgets));
}
for (index, (item, action)) in items.iter().enumerate() {
@@ -2807,7 +2865,7 @@ mod island_tests {
};
let gfx = Gfx::new()?;
strings::set_language(Language::Es);
- let mut bar = MenuBar::create(&gfx, false, true)?;
+ let mut bar = MenuBar::create(&gfx, false, true, MenuBarWidgets::default())?;
assert!(
bar.look
.as_ref()
@@ -2848,7 +2906,7 @@ mod island_tests {
})?
};
let gfx = Gfx::new()?;
- let mut bar = MenuBar::create(&gfx, false, true)?;
+ let mut bar = MenuBar::create(&gfx, false, true, MenuBarWidgets::default())?;
assert!(
!unsafe { IsWindowVisible(bar.hwnd) }.as_bool(),
"auto-hide must apply before the first frame"
@@ -2950,7 +3008,7 @@ mod island_tests {
})?
};
let gfx = Gfx::new()?;
- let mut bar = MenuBar::create(&gfx, false, true)?;
+ let mut bar = MenuBar::create(&gfx, false, true, MenuBarWidgets::default())?;
bar.set_app_name(&gfx, "Muelle animation test")?;
bar.set_auto_hide(true)?;
let inside = POINT {
diff --git a/apps/settings/src/App.tsx b/apps/settings/src/App.tsx
index f9b3ccc..c7630b7 100644
--- a/apps/settings/src/App.tsx
+++ b/apps/settings/src/App.tsx
@@ -388,36 +388,77 @@ export function App() {
</Card>
</>
) : section === "menubar" ? (
- <Card>
- <Row label={t.menuBarShow} hint={t.menuBarHint}>
- <Toggle
- label={t.menuBarShow}
- checked={config.menuBar}
- onChange={(menuBar) => update({ menuBar })}
- />
- </Row>
- <SubRow label={t.menuBarAutoHide} hint={t.menuBarAutoHideHint} open={config.menuBar}>
- <Toggle
- label={t.menuBarAutoHide}
- checked={config.menuBarAutoHide}
- onChange={(menuBarAutoHide) => update({ menuBarAutoHide })}
- />
- </SubRow>
- <SubRow label={t.aiUsage} hint={t.aiUsageHint} open={config.menuBar}>
- <Toggle
- label={t.aiUsage}
- checked={config.aiUsage}
- onChange={(aiUsage) => update({ aiUsage })}
- />
- </SubRow>
- <SubRow label={t.accessoryBattery} hint={t.accessoryBatteryHint} open={config.menuBar}>
- <Toggle
- label={t.accessoryBattery}
- checked={config.accessoryBattery}
- onChange={(accessoryBattery) => update({ accessoryBattery })}
- />
- </SubRow>
- </Card>
+ <>
+ <Card>
+ <Row label={t.menuBarShow} hint={t.menuBarHint}>
+ <Toggle
+ label={t.menuBarShow}
+ checked={config.menuBar}
+ onChange={(menuBar) => update({ menuBar })}
+ />
+ </Row>
+ <SubRow label={t.menuBarAutoHide} hint={t.menuBarAutoHideHint} open={config.menuBar}>
+ <Toggle
+ label={t.menuBarAutoHide}
+ checked={config.menuBarAutoHide}
+ onChange={(menuBarAutoHide) => update({ menuBarAutoHide })}
+ />
+ </SubRow>
+ <SubRow label={t.aiUsage} hint={t.aiUsageHint} open={config.menuBar}>
+ <Toggle
+ label={t.aiUsage}
+ checked={config.aiUsage}
+ onChange={(aiUsage) => update({ aiUsage })}
+ />
+ </SubRow>
+ <SubRow label={t.accessoryBattery} hint={t.accessoryBatteryHint} open={config.menuBar}>
+ <Toggle
+ label={t.accessoryBattery}
+ checked={config.accessoryBattery}
+ onChange={(accessoryBattery) => update({ accessoryBattery })}
+ />
+ </SubRow>
+ </Card>
+ {config.menuBar && (
+ <Card title={t.menuBarItems}>
+ <Row label={t.menuBarBluetooth} hint={t.menuBarBluetoothHint}>
+ <Toggle
+ label={t.menuBarBluetooth}
+ checked={config.menuBarBluetooth}
+ onChange={(menuBarBluetooth) => update({ menuBarBluetooth })}
+ />
+ </Row>
+ <Row label={t.menuBarBatteryPercent} hint={t.menuBarBatteryPercentHint}>
+ <Toggle
+ label={t.menuBarBatteryPercent}
+ checked={config.menuBarBatteryPercent ?? false}
+ onChange={(menuBarBatteryPercent) => update({ menuBarBatteryPercent })}
+ />
+ </Row>
+ <Row label={t.menuBarSearch} hint={t.menuBarSearchHint}>
+ <Toggle
+ label={t.menuBarSearch}
+ checked={config.menuBarSearch ?? true}
+ onChange={(menuBarSearch) => update({ menuBarSearch })}
+ />
+ </Row>
+ <Row label={t.menuBarTaskView} hint={t.menuBarTaskViewHint}>
+ <Toggle
+ label={t.menuBarTaskView}
+ checked={config.menuBarTaskView ?? true}
+ onChange={(menuBarTaskView) => update({ menuBarTaskView })}
+ />
+ </Row>
+ <Row label={t.menuBarWidgets} hint={t.menuBarWidgetsHint}>
+ <Toggle
+ label={t.menuBarWidgets}
+ checked={config.menuBarWidgets ?? true}
+ onChange={(menuBarWidgets) => update({ menuBarWidgets })}
+ />
+ </Row>
+ </Card>
+ )}
+ </>
) : (
<>
<Card>
diff --git a/apps/settings/src/config.ts b/apps/settings/src/config.ts
index 83a36d3..f46562c 100644
--- a/apps/settings/src/config.ts
+++ b/apps/settings/src/config.ts
@@ -17,6 +17,11 @@ export interface Config {
menuBarAutoHide: boolean;
aiUsage: boolean;
accessoryBattery: boolean;
+ menuBarSearch: boolean | null;
+ menuBarTaskView: boolean | null;
+ menuBarWidgets: boolean | null;
+ menuBarBluetooth: boolean;
+ menuBarBatteryPercent: boolean | null;
showIndicators: boolean;
showRecents: boolean;
bounceOnOpen: boolean;
diff --git a/apps/settings/src/i18n/en.json b/apps/settings/src/i18n/en.json
index a0aa325..2f09c2f 100644
--- a/apps/settings/src/i18n/en.json
+++ b/apps/settings/src/i18n/en.json
@@ -24,6 +24,17 @@
"accessoryBattery": "Show accessory battery",
"accessoryBatteryHint": "Detects supported mice and headsets and shows their battery levels. While off, no accessories are monitored or queried.",
"aiUsageHint": "Reads your existing sessions. Queries each provider directly every five minutes and does not save 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",
+ "menuBarSearchHint": "Show the Windows search button.",
+ "menuBarTaskView": "Task View button",
+ "menuBarTaskViewHint": "Show Task View to manage open windows and virtual desktops.",
+ "menuBarWidgets": "Widgets button",
+ "menuBarWidgetsHint": "Show the Widgets board button.",
"autostart": "Open Muelle at login",
"language": "Language",
"languageAuto": "Automatic",
diff --git a/apps/settings/src/i18n/es.json b/apps/settings/src/i18n/es.json
index ea14f0c..9521150 100644
--- a/apps/settings/src/i18n/es.json
+++ b/apps/settings/src/i18n/es.json
@@ -24,6 +24,17 @@
"accessoryBattery": "Mostrar batería de accesorios",
"accessoryBatteryHint": "Detecta ratones y auriculares compatibles y muestra su batería. Desactivado, no detecta ni consulta accesorios.",
"aiUsageHint": "Lee la cuota de las sesiones que ya tienes abiertas. Consulta directamente a cada proveedor cada cinco minutos y 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",
+ "menuBarSearchHint": "Muestra el botón de búsqueda de Windows.",
+ "menuBarTaskView": "Botón de Vista de tareas",
+ "menuBarTaskViewHint": "Muestra la Vista de tareas para ver ventanas y escritorios virtuales.",
+ "menuBarWidgets": "Botón de Widgets",
+ "menuBarWidgetsHint": "Muestra el botón del panel de widgets.",
"autostart": "Abrir Muelle al iniciar sesión",
"language": "Idioma",
"languageAuto": "Automático",
diff --git a/apps/settings/src/i18n/fr.json b/apps/settings/src/i18n/fr.json
index 0d7bc9c..3fd308a 100644
--- a/apps/settings/src/i18n/fr.json
+++ b/apps/settings/src/i18n/fr.json
@@ -24,6 +24,17 @@
"accessoryBattery": "Afficher la batterie des accessoires",
"accessoryBatteryHint": "Détecte les souris et casques compatibles et affiche leur batterie. Désactivé, aucun accessoire n’est surveillé ni interrogé.",
"aiUsageHint": "Lit le quota des sessions que vous avez déjà ouvertes. Interroge directement chaque fournisseur toutes les cinq minutes et n'enregistre aucun identifiant.",
+ "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",
+ "menuBarSearchHint": "Affiche le bouton de recherche Windows.",
+ "menuBarTaskView": "Bouton Vue des tâches",
+ "menuBarTaskViewHint": "Affiche la Vue des tâches pour gérer les fenêtres et bureaux virtuels.",
+ "menuBarWidgets": "Bouton Widgets",
+ "menuBarWidgetsHint": "Affiche le bouton du panneau des widgets.",
"autostart": "Ouvrir Muelle à l'ouverture de session",
"language": "Langue",
"languageAuto": "Automatique",
diff --git a/crates/muelle-config/src/lib.rs b/crates/muelle-config/src/lib.rs
index 5317a8c..616be1a 100644
--- a/crates/muelle-config/src/lib.rs
+++ b/crates/muelle-config/src/lib.rs
@@ -70,6 +70,16 @@ pub struct Config {
pub ai_usage: bool,
/// Opt-in peripheral monitoring. Off means no accessory reader or queries.
pub accessory_battery: bool,
+ /// Show search button in the menu bar (`None` follows Windows taskbar setting).
+ pub menu_bar_search: Option<bool>,
+ /// Show Task View button in the menu bar (`None` follows Windows taskbar setting).
+ 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.
pub show_indicators: bool,
/// The section of recently used apps that are not pinned.
@@ -163,6 +173,11 @@ impl Default for Config {
menu_bar_auto_hide: false,
ai_usage: true,
accessory_battery: false,
+ menu_bar_search: None,
+ menu_bar_task_view: None,
+ menu_bar_widgets: None,
+ menu_bar_bluetooth: true,
+ menu_bar_battery_percent: None,
show_indicators: true,
show_recents: true,
bounce_on_open: true,
diff --git a/crates/muelle-shell/src/launcher.rs b/crates/muelle-shell/src/launcher.rs
index d9d17c4..9528e7e 100644
--- a/crates/muelle-shell/src/launcher.rs
+++ b/crates/muelle-shell/src/launcher.rs
@@ -214,6 +214,11 @@ pub fn open_sound() {
}
}
+/// Opens the Windows Bluetooth settings page.
+pub fn open_bluetooth() {
+ let _ = open("ms-settings:bluetooth");
+}
+
/// Shows the desktop, or brings the windows back: what the taskbar's corner
/// button does (Win+D).
pub fn show_desktop() {
diff --git a/crates/muelle-shell/src/status.rs b/crates/muelle-shell/src/status.rs
index 149c415..2061f76 100644
--- a/crates/muelle-shell/src/status.rs
+++ b/crates/muelle-shell/src/status.rs
@@ -46,9 +46,10 @@ fn notify(window: isize, message: u32) {
pub enum Network {
Offline,
Ethernet,
- /// Signal strength from 1 to 4 bars.
+ /// Signal strength from 1 to 4 bars, and whether connected to internet.
Wifi {
bars: u8,
+ has_internet: bool,
},
}
@@ -58,12 +59,13 @@ pub fn network() -> Network {
let Ok(profile) = NetworkInformation::GetInternetConnectionProfile() else {
return Network::Offline;
};
- let connected = profile
+ let level = profile
.GetNetworkConnectivityLevel()
- .is_ok_and(|level| level != NetworkConnectivityLevel::None);
- if !connected {
+ .unwrap_or(NetworkConnectivityLevel::None);
+ if level == NetworkConnectivityLevel::None {
return Network::Offline;
}
+ let has_internet = level == NetworkConnectivityLevel::InternetAccess;
if profile.IsWlanConnectionProfile().unwrap_or(false) {
// Windows reports 0 to 5 bars; the glyphs have 4 steps.
let reported = profile
@@ -71,7 +73,7 @@ pub fn network() -> Network {
.and_then(|bars| bars.Value())
.unwrap_or(5);
let bars = (u32::from(reported.min(5)) * 4).div_ceil(5).max(1) as u8;
- Network::Wifi { bars }
+ Network::Wifi { bars, has_internet }
} else {
Network::Ethernet
}
diff --git a/crates/muelle-shell/src/system.rs b/crates/muelle-shell/src/system.rs
index 8e52f38..7a2cbb7 100644
--- a/crates/muelle-shell/src/system.rs
+++ b/crates/muelle-shell/src/system.rs
@@ -308,6 +308,7 @@ pub struct Battery {
/// 0..=100.
pub percent: u8,
pub charging: bool,
+ pub saver: bool,
}
/// Battery state, or `None` on a computer without a battery.
@@ -319,12 +320,14 @@ pub fn battery() -> Option<Battery> {
let mut status = SYSTEM_POWER_STATUS::default();
// SAFETY: `status` is a valid structure the call fills in.
unsafe { GetSystemPowerStatus(&mut status) }.ok()?;
+ let saver = energy_saver_on();
(status.BatteryFlag & NO_BATTERY == 0
&& status.BatteryFlag != UNKNOWN
&& status.BatteryLifePercent <= 100)
.then_some(Battery {
percent: status.BatteryLifePercent,
charging: status.ACLineStatus == 1,
+ saver,
})
}