Skip to content

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

feat: enhance genie effect with configurable speed and add end task functionality

CristianOlivera1e7e82d31ee14
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c212e2e..6e64f09 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,18 @@ copia la sección de la versión que se publica a la release de GitHub.
### English
+- Settings → Menu bar → Show what's playing (issue #28). The music half of
+ the island could not be turned off; now it can, and with AI usage off too
+ the menu bar shows no island at all. Off, Muelle also stops following media
+ sessions. On by default, as before.
+- Added "End task" beside "Quit" in a running app's context menu, including apps
+ inside dock groups (issue #26). Force termination runs outside the UI thread
+ against process handles captured for that menu. Explorer, critical/shared hosts
+ and inaccessible processes are excluded; cancelling the menu changes nothing.
+- Settings → Windows → Genie speed (issue #27): Normal, Fast or Faster.
+ Normal is the speed the genie always had (0.5 s, close to the macOS Dock)
+ and stays the default; Fast takes 0.35 s and Faster 0.25 s, minimizing and
+ restoring alike. The change applies to the next window at once.
- Added a persistent red attention badge for apps that request attention through
Windows, including grouped apps and minimized-window thumbnails (issue #22,
first stage). It clears on window activation/closure and follows Windows' badge
@@ -51,6 +63,20 @@ copia la sección de la versión que se publica a la release de GitHub.
### Español
+- Ajustes → Barra superior → Mostrar lo que se reproduce (issue #28). La parte
+ de música de la isla no se podía apagar; ahora sí, y si también desactivas el
+ uso de IA la barra superior no muestra ninguna isla. Apagado, Muelle deja
+ además de seguir las sesiones multimedia. Activado por defecto, como antes.
+- Añadido «Finalizar tarea» junto a «Salir» en el menú de una app abierta, también
+ dentro de grupos del dock (issue #26). La finalización forzada se ejecuta fuera
+ del hilo de interfaz y usa los procesos capturados para ese menú. Se excluyen
+ Explorer, procesos críticos/hosts compartidos y procesos sin permisos; cancelar
+ el menú no realiza ninguna acción.
+- Ajustes → Ventanas → Velocidad del genio (issue #27): Normal, Rápida o Muy
+ rápida. Normal es la velocidad de siempre (0,5 s, cercana al Dock de macOS)
+ y sigue siendo la predeterminada; Rápida dura 0,35 s y Muy rápida 0,25 s,
+ tanto al minimizar como al restaurar. Se aplica al instante a la siguiente
+ ventana.
- Añadido un badge rojo persistente para las apps que solicitan atención mediante
Windows, también en grupos y miniaturas minimizadas (issue #22, primera etapa).
Se quita al activar/cerrar la ventana y sigue en caliente la preferencia de
diff --git a/apps/dock/src/app.rs b/apps/dock/src/app.rs
index 85c0965..9264a7a 100644
--- a/apps/dock/src/app.rs
+++ b/apps/dock/src/app.rs
@@ -33,6 +33,7 @@ use muelle_core::{
};
use muelle_shell::{
appbar::{ABN_FULLSCREENAPP, AppBar, Edge},
+ end_task::PreparedEndTask,
files,
icons::IconImage,
launcher,
@@ -275,6 +276,7 @@ const CMD_TASKBAR_SETTINGS: u32 = 14;
const CMD_UNGROUP: u32 = 15;
const CMD_REMOVE_FOLDER: u32 = 16;
const CMD_FORGET_RECENT: u32 = 17;
+const CMD_END_TASK: u32 = 18;
const CMD_WINDOW: u32 = 100;
const MENU_WINDOWS: usize = 12;
const MENU_TITLE_CHARS: usize = 60;
@@ -409,6 +411,7 @@ enum Outside {
OpenStart,
Activate(Vec<isize>),
Minimize(Vec<isize>),
+ EndTask(PreparedEndTask),
Reveal(String),
EmptyBin,
OpenWith(String, Vec<String>),
@@ -482,6 +485,7 @@ enum MenuTarget {
id: String,
role: Role,
windows: Vec<isize>,
+ end_task: Option<PreparedEndTask>,
},
Dock,
}
@@ -1686,7 +1690,14 @@ impl App {
};
let flight = self.snapshots.get(position).and_then(|(_, snapshot)| {
let slot = self.minimized_slot(hwnd, snapshot.aspect())?;
- Flight::restore(&self.gfx, hwnd, snapshot, slot, screen)
+ Flight::restore(
+ &self.gfx,
+ hwnd,
+ snapshot,
+ slot,
+ screen,
+ self.config.genie_speed.seconds(),
+ )
});
let Some(flight) = flight else {
return false;
@@ -1739,7 +1750,14 @@ impl App {
let Some((from, frame)) = tracker::rect_before_minimize(hwnd, last_seen) else {
continue;
};
- if let Some(flight) = Flight::start(&self.gfx, hwnd, from, frame, screen) {
+ if let Some(flight) = Flight::start(
+ &self.gfx,
+ hwnd,
+ from,
+ frame,
+ screen,
+ self.config.genie_speed.seconds(),
+ ) {
self.flights.push(flight);
self.last_frame = Instant::now();
break;
@@ -3225,7 +3243,7 @@ impl App {
return Ok(None);
};
let windows = self.windows_of(&id);
- let items = self.entry_menu(&id, Role::App, &windows);
+ let (items, end_task) = self.entry_menu(&id, Role::App, &windows);
let gap = self
.stage
.as_ref()
@@ -3241,6 +3259,7 @@ impl App {
id,
role: Role::App,
windows,
+ end_task,
},
items,
anchor,
@@ -3299,8 +3318,17 @@ impl App {
x: stage.dock_origin.x + (rect.x + rect.width / 2.0).round() as i32,
y: stage.dock_origin.y + rect.y.round() as i32 - gap,
};
- let items = self.entry_menu(&id, role, &windows);
- (MenuTarget::Entry { id, role, windows }, items, anchor)
+ let (items, end_task) = self.entry_menu(&id, role, &windows);
+ (
+ MenuTarget::Entry {
+ id,
+ role,
+ windows,
+ end_task,
+ },
+ items,
+ anchor,
+ )
}
None => {
let anchor = POINT {
@@ -3336,10 +3364,20 @@ impl App {
})))
}
- fn entry_menu(&self, id: &str, role: Role, windows: &[isize]) -> Vec<MenuItem> {
+ fn entry_menu(
+ &self,
+ id: &str,
+ role: Role,
+ windows: &[isize],
+ ) -> (Vec<MenuItem>, Option<PreparedEndTask>) {
let is_file = !id.starts_with("shell:") && !id.starts_with("::");
let t = text();
let mut items = Vec::new();
+ let end_task = if role == Role::App && id != explorer_id() {
+ PreparedEndTask::capture(id, windows, &self.windows)
+ } else {
+ None
+ };
match role {
Role::App => {
for (index, &hwnd) in windows.iter().take(MENU_WINDOWS).enumerate() {
@@ -3379,6 +3417,14 @@ impl App {
if !windows.is_empty() {
items.push(MenuItem::Separator);
items.push(MenuItem::action(CMD_QUIT_APP, t.quit_app));
+ if id != explorer_id() {
+ items.push(MenuItem::Action {
+ command: CMD_END_TASK,
+ label: t.end_task.into(),
+ checked: false,
+ enabled: end_task.is_some(),
+ });
+ }
}
}
Role::Group => {
@@ -3414,11 +3460,17 @@ impl App {
});
}
}
- items
+ (items, end_task)
}
fn on_command(&mut self, target: MenuTarget, command: u32) -> Result<Option<Outside>> {
- let MenuTarget::Entry { id, role, windows } = target else {
+ let MenuTarget::Entry {
+ id,
+ role,
+ windows,
+ end_task,
+ } = target
+ else {
return match command {
CMD_QUIT_DOCK => Ok(Some(Outside::QuitDock)),
CMD_TOGGLE_HIDING => self.toggle_hiding().map(|()| None),
@@ -3497,6 +3549,7 @@ impl App {
launcher::close(&windows);
None
}
+ CMD_END_TASK => end_task.map(Outside::EndTask),
CMD_EMPTY_BIN => Some(Outside::EmptyBin),
window => {
let index = window.checked_sub(CMD_WINDOW).map(|index| index as usize);
@@ -3930,6 +3983,7 @@ impl App {
self.menubar = MenuBar::create(
&self.gfx,
self.config.ai_usage,
+ self.config.menu_bar_music,
self.config.menu_bar_auto_hide,
widgets,
)
@@ -3940,6 +3994,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_media_enabled(&self.gfx, self.config.menu_bar_music))
.and_then(|()| bar.set_widgets(&self.gfx, widgets))
.and_then(|()| {
let covered = primary_monitor()
@@ -4693,6 +4748,21 @@ fn run_outside(outside: Outside) {
}
menu_bar_refresh();
}
+ Outside::EndTask(target) => {
+ // Captured kernel handles are Send; no HWND or PID is resolved
+ // again after the menu. Never wait on an unresponsive UI thread.
+ let started = thread::Builder::new()
+ .name("muelle-end-task".into())
+ .spawn(move || {
+ if let Err(error) = target.terminate() {
+ muelle_shell::log::line(&format!("finalizar tarea: {error}"));
+ shell_work::notify_end_task_failed();
+ }
+ });
+ if started.is_err() {
+ shell_work::notify_end_task_failed();
+ }
+ }
Outside::Menu(request) => {
let owner = HWND(MAIN_WINDOW.load(Ordering::Relaxed) as *mut _);
with_app("abrir menú", |app| {
diff --git a/apps/dock/src/flight.rs b/apps/dock/src/flight.rs
index 6b02ca4..0b7d5d6 100644
--- a/apps/dock/src/flight.rs
+++ b/apps/dock/src/flight.rs
@@ -85,7 +85,6 @@ use windows_numerics::{Matrix3x2, Vector2};
use crate::gfx::Gfx;
-const DURATION_SECONDS: f32 = 0.5;
/// Screen rows per strip: the edge of the funnel steps by at most a few pixels.
const STRIP_ROWS: u32 = 3;
const MAX_STRIPS: u32 = 400;
@@ -180,6 +179,8 @@ pub struct Flight {
/// The window being minimized or restored.
pub hwnd: isize,
created_at: Instant,
+ /// How long the flight lasts (Settings → Genie speed).
+ seconds: f32,
foreground: isize,
overlay: HWND,
/// The window under the overlay that holds a minimize's stand-in.
@@ -354,8 +355,8 @@ fn cut(
.collect()
}
-/// Hands the flight to the compositor: every strip follows `genie` for
-/// `DURATION_SECONDS`, into the slot or (`reverse`) out of it.
+/// Hands the flight to the compositor: every strip follows `genie` for the
+/// flight's duration, into the slot or (`reverse`) out of it.
///
/// The expressions are `Genie::frame` written for the compositor: a strip's
/// top is its resting row plus `shift`, its bottom stops at the slot, and its
@@ -421,14 +422,20 @@ fn bind(
}
/// Starts the flight bound by [`bind`]: the compositor animates `bend` and
-/// `shift` for `DURATION_SECONDS` at the display's refresh rate.
-fn launch(gfx: &Gfx, genie: &Genie, drive: &CompositionPropertySet, reverse: bool) -> Result<()> {
+/// `shift` for `seconds` at the display's refresh rate.
+fn launch(
+ gfx: &Gfx,
+ genie: &Genie,
+ drive: &CompositionPropertySet,
+ reverse: bool,
+ seconds: f32,
+) -> Result<()> {
let compositor = &gfx.compositor;
let travel = (genie.slot.bottom - genie.window.top).max(0.0);
let at = |progress: f32| if reverse { 1.0 - progress } else { progress };
let linear = compositor.CreateLinearEasingFunction()?;
let duration = TimeSpan {
- Duration: (DURATION_SECONDS * 1e7) as i64,
+ Duration: (seconds * 1e7) as i64,
};
let animate = |name: &HSTRING, curve: fn(f32) -> f32, amount: f32| -> Result<()> {
let animation = compositor.CreateScalarKeyFrameAnimation()?;
@@ -477,7 +484,14 @@ impl Flight {
/// thumbnail goes; `frame` is the part that showed on screen, which the
/// genie copies and flies (the work area for a maximized window, so no
/// strip of the menu bar or desktop around it comes along).
- pub fn start(gfx: &Gfx, hwnd: isize, from: RECT, frame: RECT, screen: RECT) -> Option<Self> {
+ pub fn start(
+ gfx: &Gfx,
+ hwnd: isize,
+ from: RECT,
+ frame: RECT,
+ screen: RECT,
+ seconds: f32,
+ ) -> Option<Self> {
// A timed-out GDI call cannot be cancelled safely. Keep at most one
// outstanding copy, including a worker whose overlay was abandoned.
let capture_permit = CapturePermit::acquire()?;
@@ -562,6 +576,7 @@ impl Flight {
Some(Self {
hwnd,
created_at: Instant::now(),
+ seconds,
foreground: tracker::foreground_window(),
overlay,
stand: Some(stand),
@@ -595,6 +610,7 @@ impl Flight {
snapshot: &Snapshot,
slot: RECT,
screen: RECT,
+ seconds: f32,
) -> Option<Self> {
let window = intersect(snapshot.window, screen);
if is_empty(window) {
@@ -611,7 +627,7 @@ impl Flight {
let drive = clip_at_slot(gfx, &root, &genie, screen)
.and_then(|()| cut(gfx, &root, image, height))
.and_then(|pieces| bind(gfx, &genie, &pieces, size, true))
- .and_then(|drive| launch(gfx, &genie, &drive, true).map(|()| drive));
+ .and_then(|drive| launch(gfx, &genie, &drive, true, seconds).map(|()| drive));
let Ok(drive) = drive else {
// SAFETY: Our own window, destroyed once.
unsafe {
@@ -622,6 +638,7 @@ impl Flight {
let flight = Self {
hwnd,
created_at: Instant::now(),
+ seconds,
foreground: tracker::foreground_window(),
overlay,
stand: None,
@@ -703,7 +720,7 @@ impl Flight {
*stand_in = None;
}
}
- let t = now.saturating_duration_since(*start).as_secs_f32() / DURATION_SECONDS;
+ let t = now.saturating_duration_since(*start).as_secs_f32() / self.seconds;
if t < 1.0 {
return true;
}
@@ -781,7 +798,7 @@ impl Flight {
let Phase::Flying { start, .. } = &self.phase else {
return 0;
};
- let elapsed = now.saturating_duration_since(*start).as_secs_f32() / DURATION_SECONDS;
+ let elapsed = now.saturating_duration_since(*start).as_secs_f32() / self.seconds;
let t = if self.restoring {
1.0 - elapsed
} else {
@@ -804,7 +821,7 @@ impl Flight {
let pieces = cut(gfx, &self.root, &image, image.height)?;
let size = (image.width as f32, image.height as f32);
let drive = bind(gfx, &self.genie, &pieces, size, false)?;
- launch(gfx, &self.genie, &drive, false)?;
+ launch(gfx, &self.genie, &drive, false, self.seconds)?;
self.captured = Some((restore, window));
Ok(drive)
}
@@ -955,7 +972,7 @@ mod native_tests {
right: 250,
bottom: 170,
};
- let mut flight = Flight::start(&gfx, source.0.0 as isize, from, from, screen)
+ let mut flight = Flight::start(&gfx, source.0.0 as isize, from, from, screen, 0.5)
.ok_or_else(|| anyhow::anyhow!("could not create the native animation"))?;
let overlay = flight.overlay;
let stand = flight.stand;
diff --git a/apps/dock/src/menubar.rs b/apps/dock/src/menubar.rs
index ff1d7a0..6bbc4cf 100644
--- a/apps/dock/src/menubar.rs
+++ b/apps/dock/src/menubar.rs
@@ -332,6 +332,8 @@ pub struct MenuBar {
/// A moment for the crab, waiting for the dock (see `take_cue`).
cue: Option<(mascot::Act, i32)>,
media: Option<media::Watch>,
+ /// "Show what is playing": off, nothing listens to media sessions.
+ media_enabled: bool,
panel: Option<Island>,
visual_height: i32,
triggers_span: Span,
@@ -919,6 +921,7 @@ impl MenuBar {
pub fn create(
gfx: &Gfx,
usage_enabled: bool,
+ media_enabled: bool,
auto_hide: bool,
widgets: MenuBarWidgets,
) -> Result<Self> {
@@ -999,7 +1002,10 @@ impl MenuBar {
usage: usage_enabled.then(|| UsageMonitor::new(hwnd.0 as isize, USAGE_CHANGED)),
usage_anchors: Vec::new(),
cue: None,
- media: media::Watch::start(hwnd, MEDIA_CHANGED),
+ media: media_enabled
+ .then(|| media::Watch::start(hwnd, MEDIA_CHANGED))
+ .flatten(),
+ media_enabled,
panel: None,
visual_height: 0,
triggers_span: Span::default(),
@@ -1056,6 +1062,19 @@ impl MenuBar {
self.refresh(gfx)
}
+ /// Shows or hides what is playing. Off, the media watch stops too, so
+ /// nothing follows playback changes.
+ pub fn set_media_enabled(&mut self, gfx: &Gfx, enabled: bool) -> Result<()> {
+ if self.media_enabled == enabled {
+ return Ok(());
+ }
+ self.media_enabled = enabled;
+ self.media = enabled
+ .then(|| media::Watch::start(self.hwnd, MEDIA_CHANGED))
+ .flatten();
+ self.refresh(gfx)
+ }
+
pub fn set_accessories_enabled(&mut self, gfx: &Gfx, enabled: bool) -> Result<()> {
if self.accessories_enabled == enabled {
return Ok(());
@@ -3198,7 +3217,7 @@ mod island_tests {
})?
};
let gfx = Gfx::new()?;
- let mut bar = MenuBar::create(&gfx, false, true, MenuBarWidgets::default())?;
+ let mut bar = MenuBar::create(&gfx, false, true, true, MenuBarWidgets::default())?;
bar.set_visible(false)?;
let mut look = bar.look.clone().context("missing initial look")?;
look.track = None;
@@ -3336,7 +3355,7 @@ mod island_tests {
})?
};
let gfx = Gfx::new()?;
- let mut bar = MenuBar::create(&gfx, false, true, MenuBarWidgets::default())?;
+ let mut bar = MenuBar::create(&gfx, false, true, true, MenuBarWidgets::default())?;
bar.set_visible(false)?;
assert!(!bar.accessories_enabled && bar.accessories.is_none());
bar.restart_accessories(&gfx)?;
@@ -3410,7 +3429,7 @@ mod island_tests {
})?
};
let gfx = Gfx::new()?;
- let mut bar = MenuBar::create(&gfx, false, true, MenuBarWidgets::default())?;
+ let mut bar = MenuBar::create(&gfx, false, true, true, MenuBarWidgets::default())?;
bar.set_visible(false)?;
bar.accessories = None;
let mut look = bar.look.clone().context("missing initial menu bar")?;
@@ -3474,7 +3493,7 @@ mod island_tests {
};
let gfx = Gfx::new()?;
strings::set_language(Language::Es);
- let mut bar = MenuBar::create(&gfx, false, true, MenuBarWidgets::default())?;
+ let mut bar = MenuBar::create(&gfx, false, true, true, MenuBarWidgets::default())?;
assert!(
bar.look
.as_ref()
@@ -3515,7 +3534,7 @@ mod island_tests {
})?
};
let gfx = Gfx::new()?;
- let mut bar = MenuBar::create(&gfx, false, true, MenuBarWidgets::default())?;
+ let mut bar = MenuBar::create(&gfx, false, true, true, MenuBarWidgets::default())?;
assert!(
!unsafe { IsWindowVisible(bar.hwnd) }.as_bool(),
"auto-hide must apply before the first frame"
@@ -3617,7 +3636,7 @@ mod island_tests {
})?
};
let gfx = Gfx::new()?;
- let mut bar = MenuBar::create(&gfx, false, true, MenuBarWidgets::default())?;
+ let mut bar = MenuBar::create(&gfx, false, true, true, MenuBarWidgets::default())?;
bar.set_app_name(&gfx, "Muelle animation test")?;
bar.set_auto_hide(true)?;
let inside = POINT {
diff --git a/apps/dock/src/shell_work.rs b/apps/dock/src/shell_work.rs
index b91d7bb..98d7f25 100644
--- a/apps/dock/src/shell_work.rs
+++ b/apps/dock/src/shell_work.rs
@@ -186,13 +186,20 @@ pub fn dispatch(action: Action) -> Result<()> {
/// A rejected request must be visible to the user, without blocking the UI
/// or creating a new dialog for every repeated click on a full queue.
pub fn notify_not_started() {
+ notify_failure(crate::strings::text().shell_operation_failed);
+}
+
+pub fn notify_end_task_failed() {
+ notify_failure(crate::strings::text().end_task_failed);
+}
+
+fn notify_failure(message: &'static str) {
use std::sync::atomic::{AtomicBool, Ordering};
use windows::Win32::UI::WindowsAndMessaging::{MB_ICONWARNING, MB_OK, MessageBoxW};
static SHOWING: AtomicBool = AtomicBool::new(false);
if SHOWING.swap(true, Ordering::AcqRel) {
return;
}
- let message = crate::strings::text().shell_operation_failed;
let shown = thread::Builder::new()
.name("muelle-shell-notice".into())
.spawn(move || {
diff --git a/apps/dock/src/strings.rs b/apps/dock/src/strings.rs
index 10924bc..ffb6110 100644
--- a/apps/dock/src/strings.rs
+++ b/apps/dock/src/strings.rs
@@ -13,6 +13,8 @@ pub struct Strings {
pub keep_in_dock: &'static str,
pub show_in_explorer: &'static str,
pub quit_app: &'static str,
+ pub end_task: &'static str,
+ pub end_task_failed: &'static str,
pub empty_bin: &'static str,
pub turn_hiding_on: &'static str,
pub turn_hiding_off: &'static str,
@@ -61,6 +63,8 @@ const ES: Strings = Strings {
keep_in_dock: "&Mantener en el Dock",
show_in_explorer: "Mostrar en el &Explorador",
quit_app: "&Salir",
+ end_task: "&Finalizar tarea",
+ end_task_failed: "No se pudo finalizar la tarea. Abre el Administrador de tareas con Ctrl+Mayús+Esc; puede requerir permisos de administrador.",
empty_bin: "&Vaciar papelera",
turn_hiding_on: "Activar &ocultación automática",
turn_hiding_off: "Desactivar &ocultación automática",
@@ -106,6 +110,8 @@ const EN: Strings = Strings {
keep_in_dock: "&Keep in Dock",
show_in_explorer: "Show in &Explorer",
quit_app: "&Quit",
+ end_task: "&End task",
+ end_task_failed: "The task could not be ended. Open Task Manager with Ctrl+Shift+Esc; administrator permissions may be required.",
empty_bin: "&Empty Recycle Bin",
turn_hiding_on: "Turn Hiding &On",
turn_hiding_off: "Turn Hiding &Off",
@@ -151,6 +157,8 @@ const FR: Strings = Strings {
keep_in_dock: "&Garder dans le Dock",
show_in_explorer: "Afficher dans l'&Explorateur",
quit_app: "&Quitter",
+ end_task: "&Forcer l’arrêt",
+ end_task_failed: "Impossible de terminer la tâche. Ouvrez le Gestionnaire des tâches avec Ctrl+Maj+Échap ; des droits administrateur peuvent être nécessaires.",
empty_bin: "&Vider la Corbeille",
turn_hiding_on: "Activer le &masquage automatique",
turn_hiding_off: "Désactiver le &masquage automatique",
diff --git a/apps/settings/src/App.tsx b/apps/settings/src/App.tsx
index d1e1c2a..440d0d7 100644
--- a/apps/settings/src/App.tsx
+++ b/apps/settings/src/App.tsx
@@ -4,6 +4,7 @@ import { getCurrentWindow } from "@tauri-apps/api/window";
import { useCallback, useEffect, useRef, useState } from "react";
import {
type Config,
+ type GenieSpeed,
type IslandStyle,
type Language,
type UpdateInfo,
@@ -374,6 +375,18 @@ export function App() {
onChange={(genie) => update({ genie })}
/>
</Row>
+ <SubRow label={t.genieSpeed} hint={t.genieSpeedHint} open={config.genie}>
+ <Segmented<GenieSpeed>
+ label={t.genieSpeed}
+ value={config.genieSpeed}
+ options={[
+ { value: "normal", label: t.genieSpeedNormal },
+ { value: "fast", label: t.genieSpeedFast },
+ { value: "faster", label: t.genieSpeedFaster },
+ ]}
+ onChange={(genieSpeed) => update({ genieSpeed })}
+ />
+ </SubRow>
<SubRow label={t.genieOff} hint={t.genieOffHint} open={config.genie && !animations}>
<button type="button" className="push" onClick={() => void openAnimationSettings()}>
{t.genieOffAction}
@@ -405,6 +418,13 @@ export function App() {
onChange={(menuBarAutoHide) => update({ menuBarAutoHide })}
/>
</SubRow>
+ <SubRow label={t.menuBarMusic} hint={t.menuBarMusicHint} open={config.menuBar}>
+ <Toggle
+ label={t.menuBarMusic}
+ checked={config.menuBarMusic}
+ onChange={(menuBarMusic) => update({ menuBarMusic })}
+ />
+ </SubRow>
<SubRow label={t.aiUsage} hint={t.aiUsageHint} open={config.menuBar}>
<Toggle
label={t.aiUsage}
@@ -412,7 +432,11 @@ export function App() {
onChange={(aiUsage) => update({ aiUsage })}
/>
</SubRow>
- <SubRow label={t.islandStyle} hint={t.islandStyleHint} open={config.menuBar}>
+ <SubRow
+ label={t.islandStyle}
+ hint={t.islandStyleHint}
+ open={config.menuBar && (config.menuBarMusic || config.aiUsage)}
+ >
<Segmented<IslandStyle>
label={t.islandStyle}
value={config.menuBarIslandStyle}
diff --git a/apps/settings/src/config.ts b/apps/settings/src/config.ts
index 0f720ef..5190637 100644
--- a/apps/settings/src/config.ts
+++ b/apps/settings/src/config.ts
@@ -2,6 +2,7 @@ import { invoke } from "@tauri-apps/api/core";
export type Language = "auto" | "es" | "en" | "fr";
export type IslandStyle = "notch" | "bubble";
+export type GenieSpeed = "normal" | "fast" | "faster";
/** Mirrors `muelle_config::Config`. */
export interface Config {
@@ -13,10 +14,12 @@ export interface Config {
magnification: boolean;
magnifiedSize: number;
genie: boolean;
+ genieSpeed: GenieSpeed;
showMinimized: boolean;
menuBar: boolean;
menuBarAutoHide: boolean;
aiUsage: boolean;
+ menuBarMusic: boolean;
menuBarIslandStyle: IslandStyle;
accessoryBattery: boolean;
menuBarSearch: boolean | null;
diff --git a/apps/settings/src/i18n/en.json b/apps/settings/src/i18n/en.json
index 3157370..fac3203 100644
--- a/apps/settings/src/i18n/en.json
+++ b/apps/settings/src/i18n/en.json
@@ -11,6 +11,11 @@
"autoHideHint": "Rest the pointer at the bottom edge of any display to reveal the Dock there.",
"genie": "Genie effect",
"genieHint": "While it is on, windows do not use the Windows animations for maximizing or closing.",
+ "genieSpeed": "Genie speed",
+ "genieSpeedHint": "How long windows take to fly into the dock and back.",
+ "genieSpeedNormal": "Normal",
+ "genieSpeedFast": "Fast",
+ "genieSpeedFaster": "Faster",
"genieOff": "Windows animations are off",
"genieOffHint": "The genie follows Windows' \"Animation effects\" setting, as every app should, so it does not play. Choosing \"Adjust for best performance\" in Windows turns it off too.",
"genieOffAction": "Open Windows settings",
@@ -20,6 +25,8 @@
"menuBarHint": "Time, battery, and access to the Windows quick settings and notifications.",
"menuBarAutoHide": "Automatically hide and show the menu bar",
"menuBarAutoHideHint": "It appears when the pointer rests on the top edge of the screen, never over a window's close buttons.",
+ "menuBarMusic": "Show what's playing",
+ "menuBarMusicHint": "Title and controls of the music or video playing. With this and AI usage off, the menu bar shows no island.",
"aiUsage": "Show AI provider usage",
"islandStyle": "Indicator style",
"islandStyleHint": "Choose between the centered notch or a compact bubble next to the status indicators.",
diff --git a/apps/settings/src/i18n/es.json b/apps/settings/src/i18n/es.json
index 54d8925..5c9e5e9 100644
--- a/apps/settings/src/i18n/es.json
+++ b/apps/settings/src/i18n/es.json
@@ -11,6 +11,11 @@
"autoHideHint": "Deja el puntero en el borde inferior de cualquier pantalla para mostrar el Dock allí.",
"genie": "Efecto genio",
"genieHint": "Mientras está activo, las ventanas no usan las animaciones de Windows al maximizar ni al cerrar.",
+ "genieSpeed": "Velocidad del genio",
+ "genieSpeedHint": "Lo que tardan las ventanas en entrar al dock y en volver.",
+ "genieSpeedNormal": "Normal",
+ "genieSpeedFast": "Rápida",
+ "genieSpeedFaster": "Muy rápida",
"genieOff": "Las animaciones de Windows están desactivadas",
"genieOffHint": "El genio sigue el ajuste «Efectos de animación» de Windows, como debe hacer toda app, así que no se reproduce. La opción «Ajustar para obtener el mejor rendimiento» también lo apaga.",
"genieOffAction": "Abrir la configuración de Windows",
@@ -20,6 +25,8 @@
"menuBarHint": "Hora, batería y acceso a los ajustes rápidos y las notificaciones de Windows.",
"menuBarAutoHide": "Ocultar y mostrar la barra superior automáticamente",
"menuBarAutoHideHint": "Aparece cuando el puntero se detiene en el borde superior de la pantalla, nunca encima de los botones de cerrar de una ventana.",
+ "menuBarMusic": "Mostrar lo que se reproduce",
+ "menuBarMusicHint": "Título y controles de la música o el vídeo en reproducción. Si lo desactivas junto con el uso de IA, la barra superior no muestra ninguna isla.",
"aiUsage": "Mostrar uso de proveedores de IA",
"islandStyle": "Estilo del indicador",
"islandStyleHint": "Elige entre la muesca centrada o una burbuja compacta junto a los indicadores de estado.",
diff --git a/apps/settings/src/i18n/fr.json b/apps/settings/src/i18n/fr.json
index 53d7caa..55167c0 100644
--- a/apps/settings/src/i18n/fr.json
+++ b/apps/settings/src/i18n/fr.json
@@ -11,6 +11,11 @@
"autoHideHint": "Laissez le pointeur sur le bord inférieur d'un écran pour y afficher le Dock.",
"genie": "Effet génie",
"genieHint": "Tant qu'il est activé, les fenêtres n'utilisent pas les animations de Windows pour l'agrandissement et la fermeture.",
+ "genieSpeed": "Vitesse du génie",
+ "genieSpeedHint": "Le temps que mettent les fenêtres à entrer dans le Dock et à en revenir.",
+ "genieSpeedNormal": "Normale",
+ "genieSpeedFast": "Rapide",
+ "genieSpeedFaster": "Très rapide",
"genieOff": "Les animations de Windows sont désactivées",
"genieOffHint": "L'effet génie suit le réglage « Effets d'animation » de Windows, comme toute app devrait le faire : il ne se joue donc pas. L'option « Ajuster afin d'obtenir les meilleures performances » le désactive aussi.",
"genieOffAction": "Ouvrir les paramètres de Windows",
@@ -20,6 +25,8 @@
"menuBarHint": "Heure, batterie et accès aux paramètres rapides et aux notifications de Windows.",
"menuBarAutoHide": "Masquer et afficher automatiquement la barre de menus",
"menuBarAutoHideHint": "Elle apparaît quand le pointeur s'arrête sur le bord supérieur de l'écran, jamais par-dessus les boutons de fermeture d'une fenêtre.",
+ "menuBarMusic": "Afficher la lecture en cours",
+ "menuBarMusicHint": "Titre et commandes de la musique ou de la vidéo en cours. Désactivé avec l'utilisation de l'IA, la barre des menus n'affiche plus d'îlot.",
"aiUsage": "Afficher l'utilisation des fournisseurs d'IA",
"islandStyle": "Style de l'indicateur",
"islandStyleHint": "Choisissez entre l'encoche centrée ou une bulle compacte à côté des indicateurs d'état.",
diff --git a/crates/muelle-config/src/lib.rs b/crates/muelle-config/src/lib.rs
index c8e5588..d97b933 100644
--- a/crates/muelle-config/src/lib.rs
+++ b/crates/muelle-config/src/lib.rs
@@ -59,6 +59,8 @@ pub struct Config {
/// Genie effect when minimizing. On by default; while enabled, the dock
/// turns off the system's own window transitions (see plan, "Efecto genio").
pub genie: bool,
+ /// How long the genie takes (issue #27). `Normal` is the original speed.
+ pub genie_speed: GenieSpeed,
/// Minimized windows get a live thumbnail in the right section of the
/// dock. Off by default: they go into their app's icon instead.
pub show_minimized: bool,
@@ -68,6 +70,9 @@ pub struct Config {
pub menu_bar_auto_hide: bool,
/// Show supported AI providers' plan usage in the menu bar.
pub ai_usage: bool,
+ /// Show what is playing (title, controls) in the menu bar. With this and
+ /// `ai_usage` off there is no island at all (issue #28).
+ pub menu_bar_music: bool,
/// Visual style and placement of the music and AI usage island in the menu bar.
pub menu_bar_island_style: IslandStyle,
/// Opt-in peripheral monitoring. Off means no accessory reader or queries.
@@ -114,6 +119,32 @@ pub struct DockGroup {
pub apps: Vec<String>,
}
+/// Speed of the genie. Three steps, not a slider: a duration in milliseconds
+/// would ask the user to guess, and these three cover what anyone asked for.
+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "lowercase")]
+pub enum GenieSpeed {
+ Fast,
+ Faster,
+ /// The original 0.5 s, close to the macOS Dock. Also what an unknown
+ /// value from a newer version reads as (serde needs it last).
+ #[default]
+ #[serde(other)]
+ Normal,
+}
+
+impl GenieSpeed {
+ /// How long one genie flight lasts, minimizing or restoring.
+ #[must_use]
+ pub fn seconds(self) -> f32 {
+ match self {
+ Self::Normal => 0.5,
+ Self::Fast => 0.35,
+ Self::Faster => 0.25,
+ }
+ }
+}
+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum IslandStyle {
@@ -181,10 +212,12 @@ impl Default for Config {
magnification: true,
magnified_size: 77,
genie: true,
+ genie_speed: GenieSpeed::Normal,
show_minimized: false,
menu_bar: true,
menu_bar_auto_hide: false,
ai_usage: true,
+ menu_bar_music: true,
menu_bar_island_style: IslandStyle::Notch,
accessory_battery: false,
menu_bar_search: None,
@@ -455,6 +488,7 @@ mod tests {
// Files from before automatic updates get them, like new installs.
assert!(config.auto_update);
assert!(config.ai_usage);
+ assert!(config.menu_bar_music);
assert!(!config.accessory_battery);
assert!(!config.show_minimized);
}
@@ -587,6 +621,20 @@ mod tests {
#[test]
fn genie_should_be_on_by_default() {
assert!(Config::default().genie);
+ assert_eq!(Config::default().genie_speed, GenieSpeed::Normal);
+ }
+
+ #[test]
+ fn genie_speed_keeps_the_original_speed_unless_chosen() {
+ // Files from before the setting, and values from newer versions.
+ for json in [r#"{}"#, r#"{"genieSpeed":"warp"}"#] {
+ let config: Config = serde_json::from_str(json).unwrap_or_default();
+ assert_eq!(config.genie_speed, GenieSpeed::Normal);
+ }
+ let fast: Config = serde_json::from_str(r#"{"genieSpeed":"faster"}"#).unwrap_or_default();
+ assert_eq!(fast.genie_speed, GenieSpeed::Faster);
+ assert!(GenieSpeed::Faster.seconds() < GenieSpeed::Fast.seconds());
+ assert!(GenieSpeed::Fast.seconds() < GenieSpeed::Normal.seconds());
}
#[test]
diff --git a/crates/muelle-shell/src/end_task.rs b/crates/muelle-shell/src/end_task.rs
new file mode 100644
index 0000000..a027361
--- /dev/null
+++ b/crates/muelle-shell/src/end_task.rs
@@ -0,0 +1,368 @@
+//! Explicit force termination of a selected app's window-owning processes.
+//! Handles are captured before opening the menu, never reopened by PID/name
+//! after it closes. No process-tree traversal or automatic elevation.
+
+use std::{
+ collections::HashSet,
+ os::windows::io::{AsRawHandle, FromRawHandle, OwnedHandle},
+};
+
+use windows::{
+ Win32::{
+ Foundation::{HANDLE, HWND, WAIT_OBJECT_0},
+ Storage::Packaging::Appx::GetApplicationUserModelId,
+ System::Threading::{
+ GetCurrentProcessId, IsProcessCritical, OpenProcess, PROCESS_NAME_WIN32,
+ PROCESS_QUERY_LIMITED_INFORMATION, PROCESS_SYNCHRONIZE, PROCESS_TERMINATE,
+ QueryFullProcessImageNameW, TerminateProcess, WaitForSingleObject,
+ },
+ UI::WindowsAndMessaging::{GetShellWindow, GetWindowThreadProcessId},
+ },
+ core::{BOOL, PWSTR},
+};
+
+use crate::tracker::{self, TrackedWindow};
+
+pub struct PreparedEndTask {
+ processes: Vec<OwnedHandle>,
+}
+
+fn window_pid(window: isize) -> u32 {
+ let mut pid = 0;
+ // SAFETY: Read-only query; a destroyed window yields zero.
+ unsafe {
+ GetWindowThreadProcessId(HWND(window as *mut _), Some(&mut pid));
+ }
+ pid
+}
+
+fn protected_pid(pid: u32, own: u32, shell: u32) -> bool {
+ pid <= 4 || pid == own || pid == shell
+}
+
+fn shared_host(image: &str) -> bool {
+ matches!(
+ image
+ .rsplit('\\')
+ .next()
+ .unwrap_or(image)
+ .to_ascii_lowercase()
+ .as_str(),
+ "applicationframehost.exe" | "runtimebroker.exe" | "dllhost.exe" | "svchost.exe"
+ )
+}
+
+impl PreparedEndTask {
+ /// Capture all eligible processes or refuse the entire action. Keeps closed
+ /// menu targets tied to their original kernel objects even if PIDs/HWNDs
+ /// are reused. Protected/elevated/shared-host targets remain unavailable.
+ #[must_use]
+ pub fn capture(app: &str, windows: &[isize], peers: &[TrackedWindow]) -> Option<Self> {
+ if windows.is_empty() || windows.len() > 128 {
+ return None;
+ }
+ let own = unsafe { GetCurrentProcessId() };
+ let shell = window_pid(unsafe { GetShellWindow() }.0 as isize);
+ let shared: HashSet<u32> = peers
+ .iter()
+ .filter(|peer| peer.app_id != app)
+ .map(|peer| window_pid(peer.hwnd))
+ .collect();
+ let mut seen = HashSet::new();
+ let mut processes = Vec::new();
+ for &window in windows {
+ let pid = window_pid(window);
+ if pid == 0 {
+ continue;
+ }
+ if protected_pid(pid, own, shell) {
+ return None;
+ }
+ if seen.contains(&pid) {
+ continue;
+ }
+ // A window can close/restart while its icon's context menu opens.
+ let raw = unsafe {
+ OpenProcess(
+ PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_TERMINATE | PROCESS_SYNCHRONIZE,
+ false,
+ pid,
+ )
+ }
+ .ok()?;
+ // SAFETY: OpenProcess transferred one valid, uniquely owned handle.
+ let handle = unsafe { OwnedHandle::from_raw_handle(raw.0) };
+ let mut critical = BOOL::default();
+ unsafe { IsProcessCritical(raw, &mut critical) }.ok()?;
+ if critical.as_bool() {
+ return None;
+ }
+ let mut image = [0u16; 1024];
+ let mut len = image.len() as u32;
+ unsafe {
+ QueryFullProcessImageNameW(
+ raw,
+ PROCESS_NAME_WIN32,
+ PWSTR(image.as_mut_ptr()),
+ &mut len,
+ )
+ }
+ .ok()?;
+ let image = String::from_utf16_lossy(&image[..len as usize]);
+ if shared_host(&image)
+ || image
+ .rsplit('\\')
+ .next()
+ .is_some_and(|name| name.eq_ignore_ascii_case("explorer.exe"))
+ {
+ return None;
+ }
+ // Query process identity directly. A property-store/COM request to
+ // a hung window must never delay opening its recovery menu.
+ let identity = if app.starts_with("shell:AppsFolder\\") {
+ let mut aumid = [0u16; 1024];
+ len = aumid.len() as u32;
+ unsafe {
+ GetApplicationUserModelId(raw, &mut len, Some(PWSTR(aumid.as_mut_ptr())))
+ }
+ .ok()
+ .ok()?;
+ format!(
+ "shell:AppsFolder\\{}",
+ String::from_utf16_lossy(&aumid[..len.saturating_sub(1) as usize])
+ )
+ } else {
+ tracker::normalize_id(&image)
+ };
+ if identity != app || window_pid(window) != pid {
+ return None;
+ }
+ // Some hosts (e.g. office suites) give different apps windows in
+ // the same process. Never end the other app through this menu.
+ if shared.contains(&pid) {
+ return None;
+ }
+ seen.insert(pid);
+ processes.push(handle);
+ }
+ (!processes.is_empty()).then_some(Self { processes })
+ }
+
+ /// Requests termination without waiting on the UI or calling into a hung
+ /// window. Natural exits during an open menu are harmless no-ops.
+ pub fn terminate(self) -> windows::core::Result<()> {
+ let mut failure = None;
+ for process in self.processes {
+ let handle = HANDLE(process.as_raw_handle());
+ if unsafe { WaitForSingleObject(handle, 0) } == WAIT_OBJECT_0 {
+ continue;
+ }
+ let result = (|| {
+ let mut critical = BOOL::default();
+ unsafe {
+ IsProcessCritical(handle, &mut critical)?;
+ }
+ if critical.as_bool() {
+ return Err(windows::core::Error::from_hresult(
+ windows::Win32::Foundation::E_ACCESSDENIED,
+ ));
+ }
+ // SAFETY: Only the original, explicitly selected process is
+ // targeted. Its handle stays alive throughout this call.
+ unsafe { TerminateProcess(handle, 1) }
+ })();
+ if let Err(error) = result {
+ // Exiting between the check and TerminateProcess is success.
+ if unsafe { WaitForSingleObject(handle, 0) } != WAIT_OBJECT_0 {
+ failure.get_or_insert(error);
+ }
+ }
+ }
+ failure.map_or(Ok(()), Err)
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use std::{
+ io::{BufRead, BufReader, Write},
+ os::windows::process::CommandExt,
+ process::{Child, Command, Stdio},
+ sync::mpsc,
+ time::Duration,
+ };
+
+ struct Fixture {
+ child: Child,
+ windows: [isize; 2],
+ }
+ impl Drop for Fixture {
+ fn drop(&mut self) {
+ let _ = self.child.kill();
+ let _ = self.child.wait();
+ }
+ }
+ impl Fixture {
+ fn spawn() -> Result<Self, Box<dyn std::error::Error>> {
+ let child = Command::new(std::env::current_exe()?)
+ .args([
+ "--exact",
+ "end_task::tests::end_task_frozen_fixture",
+ "--ignored",
+ "--nocapture",
+ ])
+ .creation_flags(0x0800_0000)
+ .stdout(Stdio::piped())
+ .stderr(Stdio::null())
+ .spawn()?;
+ let mut fixture = Self {
+ child,
+ windows: [0, 0],
+ };
+ let stdout = fixture
+ .child
+ .stdout
+ .take()
+ .ok_or("missing fixture stdout")?;
+ let (send, receive) = mpsc::channel();
+ std::thread::spawn(move || {
+ for line in BufReader::new(stdout).lines().map_while(Result::ok) {
+ if let Some(handles) = line.strip_prefix("MUELLE_END_TASK_FIXTURE ") {
+ let _ = send.send(handles.to_owned());
+ break;
+ }
+ }
+ });
+ let handles = receive.recv_timeout(Duration::from_secs(5))?;
+ let handles: Vec<isize> = handles
+ .split_whitespace()
+ .map(str::parse)
+ .collect::<Result<_, _>>()?;
+ fixture.windows = handles
+ .try_into()
+ .map_err(|_| "wrong fixture window count")?;
+ Ok(fixture)
+ }
+ fn app() -> Result<String, Box<dyn std::error::Error>> {
+ Ok(tracker::normalize_id(
+ &std::env::current_exe()?.to_string_lossy(),
+ ))
+ }
+ }
+
+ #[test]
+ #[ignore = "Internal subprocess fixture, started only by the native end-task tests"]
+ fn end_task_frozen_fixture() -> windows::core::Result<()> {
+ use windows::Win32::UI::WindowsAndMessaging::{
+ CreateWindowExW, WS_EX_TOOLWINDOW, WS_OVERLAPPEDWINDOW,
+ };
+ let create = || unsafe {
+ CreateWindowExW(
+ WS_EX_TOOLWINDOW,
+ windows::core::w!("STATIC"),
+ windows::core::w!("Muelle frozen end-task fixture"),
+ WS_OVERLAPPEDWINDOW,
+ -32000,
+ -32000,
+ 160,
+ 120,
+ None,
+ None,
+ None,
+ None,
+ )
+ };
+ let first = create()?;
+ let second = create()?;
+ println!(
+ "MUELLE_END_TASK_FIXTURE {} {}",
+ first.0 as isize, second.0 as isize
+ );
+ let _ = std::io::stdout().flush();
+ // Deliberately no message pump: Quit/WM_CLOSE cannot make progress.
+ std::thread::sleep(Duration::from_secs(60));
+ Ok(())
+ }
+
+ #[test]
+ #[ignore = "Terminates only test-owned frozen child processes"]
+ fn native_end_task_kills_only_the_selected_frozen_process_and_deduplicates_windows()
+ -> Result<(), Box<dyn std::error::Error>> {
+ use windows::Win32::UI::WindowsAndMessaging::{
+ SMTO_ABORTIFHUNG, SendMessageTimeoutW, WM_NULL,
+ };
+ let mut victim = Fixture::spawn()?;
+ let mut peer = Fixture::spawn()?;
+ let app = Fixture::app()?;
+ let peers = vec![TrackedWindow {
+ hwnd: peer.windows[0],
+ app_id: app.clone(),
+ minimized: false,
+ }];
+ let prepared =
+ PreparedEndTask::capture(&app, &victim.windows, &peers).ok_or("capture failed")?;
+ assert_eq!(prepared.processes.len(), 1);
+ assert_eq!(
+ unsafe {
+ SendMessageTimeoutW(
+ HWND(victim.windows[0] as *mut _),
+ WM_NULL,
+ windows::Win32::Foundation::WPARAM(0),
+ windows::Win32::Foundation::LPARAM(0),
+ SMTO_ABORTIFHUNG,
+ 50,
+ None,
+ )
+ }
+ .0,
+ 0
+ );
+ prepared.terminate()?;
+ assert_eq!(
+ unsafe { WaitForSingleObject(HANDLE(victim.child.as_raw_handle()), 2_000) },
+ WAIT_OBJECT_0
+ );
+ assert!(victim.child.try_wait()?.is_some());
+ assert!(peer.child.try_wait()?.is_none());
+ Ok(())
+ }
+
+ #[test]
+ #[ignore = "Uses only test-owned child processes to validate stale menus and shared hosts"]
+ fn native_end_task_stale_or_cancelled_menu_cannot_kill_a_new_or_unrelated_process()
+ -> Result<(), Box<dyn std::error::Error>> {
+ let mut victim = Fixture::spawn()?;
+ let app = Fixture::app()?;
+ let cancelled =
+ PreparedEndTask::capture(&app, &victim.windows, &[]).ok_or("capture failed")?;
+ drop(cancelled);
+ assert!(victim.child.try_wait()?.is_none());
+ assert!(PreparedEndTask::capture("wrong-app", &victim.windows, &[]).is_none());
+ let shared = [TrackedWindow {
+ hwnd: victim.windows[1],
+ app_id: "different-app".into(),
+ minimized: false,
+ }];
+ assert!(PreparedEndTask::capture(&app, &victim.windows[..1], &shared).is_none());
+ let stale = PreparedEndTask::capture(&app, &victim.windows, &[]).ok_or("capture failed")?;
+ victim.child.kill()?;
+ victim.child.wait()?;
+ let mut replacement = Fixture::spawn()?;
+ stale.terminate()?;
+ assert!(replacement.child.try_wait()?.is_none());
+ Ok(())
+ }
+
+ #[test]
+ fn end_task_refuses_system_shell_self_and_shared_hosts() {
+ for pid in [0, 4, 100, 200] {
+ assert!(protected_pid(pid, 100, 200));
+ }
+ assert!(!protected_pid(300, 100, 200));
+ assert!(shared_host(r"C:\Windows\System32\ApplicationFrameHost.exe"));
+ assert!(shared_host(r"C:\Windows\System32\RuntimeBroker.exe"));
+ assert!(!shared_host(r"C:\Apps\chat.exe"));
+ assert!(PreparedEndTask::capture("closed", &[], &[]).is_none());
+ }
+}
diff --git a/crates/muelle-shell/src/lib.rs b/crates/muelle-shell/src/lib.rs
index b035cbe..52476ec 100644
--- a/crates/muelle-shell/src/lib.rs
+++ b/crates/muelle-shell/src/lib.rs
@@ -2,6 +2,7 @@ pub mod accessories;
pub mod appbar;
pub mod autostart;
pub mod dock_link;
+pub mod end_task;
pub mod files;
pub mod folder;
pub mod icon_cache;