A lightweight, macOS-style dock for Windows 11, with glass visuals, smooth magnification, and Genie effect.
feat: update version to 0.1.1 and enhance app behavior with new settings
CristianOlivera124b361aaec91
diff --git a/Cargo.lock b/Cargo.lockindex b7f7ec4..b788b07 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -1954,7 +1954,7 @@ dependencies = [[[package]]name = "muelle"-version = "0.1.0"+version = "0.1.1"dependencies = ["anyhow","muelle-config",@@ -1968,7 +1968,7 @@ dependencies = [[[package]]name = "muelle-config"-version = "0.1.0"+version = "0.1.1"dependencies = ["serde","serde_json",@@ -1977,11 +1977,11 @@ dependencies = [[[package]]name = "muelle-core"-version = "0.1.0"+version = "0.1.1"[[package]]name = "muelle-settings"-version = "0.1.0"+version = "0.1.1"dependencies = ["muelle-config","muelle-shell",@@ -1994,7 +1994,7 @@ dependencies = [[[package]]name = "muelle-shell"-version = "0.1.0"+version = "0.1.1"dependencies = ["thiserror 2.0.21","windows",diff --git a/Cargo.toml b/Cargo.tomlindex 56041b8..21c36b9 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -3,7 +3,7 @@ resolver = "3"members = ["crates/*", "apps/dock", "apps/settings/src-tauri", "spikes"][workspace.package]-version = "0.1.0"+version = "0.1.1"edition = "2024"license = "MIT"diff --git a/apps/dock/src/app.rs b/apps/dock/src/app.rsindex 00b3d69..62f8699 100644--- a/apps/dock/src/app.rs+++ b/apps/dock/src/app.rs@@ -22,7 +22,7 @@ use std::{};use anyhow::{Context, Result};-use muelle_config::Config;+use muelle_config::{ActiveAppClick, Config};use muelle_core::{bounce,layout::{ItemKind, Layout, Metrics, layout},@@ -230,6 +230,7 @@ enum Outside {Open(String),OpenStart,Activate(Vec<isize>),+ Minimize(Vec<isize>),Reveal(String),EmptyBin,OpenWith(String, Vec<String>),@@ -319,6 +320,7 @@ struct StageKey {auto_hide: bool,icon_size: u32,max_scale: f32,+ indicators: bool,entries: Vec<Entry>,}@@ -530,7 +532,7 @@ impl App {.map(|app| icon(&app.id, Role::App, app.running)).collect();entries.insert(0, icon(START_ID, Role::Start, false));- if !self.roster.recent().is_empty() {+ if self.config.show_recents && !self.roster.recent().is_empty() {entries.push(separator());entries.extend(self.roster@@ -623,6 +625,7 @@ impl App {auto_hide: self.config.auto_hide,icon_size: self.config.icon_size,max_scale: self.config.max_scale(),+ indicators: self.config.show_indicators,entries: self.current_entries(),};if self.stage.as_ref().is_some_and(|stage| stage.key == key) {@@ -698,7 +701,7 @@ impl App {SlotContent {icon: asset.and_then(|asset| asset.icon.as_ref()),label: asset.and_then(|asset| asset.label.as_ref()),- running: entry.running,+ running: entry.running && self.config.show_indicators,badge,}})@@ -1379,7 +1382,8 @@ impl App {}/// On icon click, launches a closed app or brings its windows to the- /// foreground. Does nothing if the app is already in front, as in macOS.+ /// foreground. Clicking the app that is already in front minimizes it, as+ /// the Windows taskbar does; the next click brings it back.fn on_click(&mut self) -> Result<Option<Outside>> {let Some(entry) = self.hovered.and_then(|index| self.entries.get(index)) else {return Ok(None);@@ -1394,7 +1398,12 @@ impl App {self.start_bounce(id.clone(), None);Some(Outside::Open(id))}- Role::App if windows.contains(&tracker::foreground_window()) => None,+ Role::App if windows.contains(&tracker::foreground_window()) => {+ match self.config.active_app_click {+ ActiveAppClick::Minimize => Some(Outside::Minimize(windows)),+ ActiveAppClick::Nothing => None,+ }+ }Role::App => self.activating(windows),Role::Start => Some(Outside::OpenStart),Role::Window => window_of(&id).and_then(|hwnd| self.activating(vec![hwnd])),@@ -1627,7 +1636,12 @@ impl App {self.refresh()}+ /// `until: None` is the bounce of an app being opened, which the user can+ /// turn off; a request for attention always bounces.fn start_bounce(&mut self, id: String, until: Option<f32>) {+ if until.is_none() && !self.config.bounce_on_open {+ return;+ }self.bounces.entry(id).or_insert(Bounce {start: Instant::now(),until,@@ -1976,6 +1990,7 @@ fn run_outside(outside: Outside) {Outside::Open(id) => report(launcher::open(&id)),Outside::OpenStart => launcher::open_start_menu(),Outside::Activate(windows) => launcher::activate(&windows),+ Outside::Minimize(windows) => launcher::minimize(&windows),Outside::Reveal(path) => report(launcher::reveal(&path)),Outside::OpenWith(app, files) => report(launcher::open_with(&app, &files)),Outside::Recycle(paths) => files::recycle(main_window(), &paths),diff --git a/apps/settings/src-tauri/src/main.rs b/apps/settings/src-tauri/src/main.rsindex fef43e1..a2bdbe5 100644--- a/apps/settings/src-tauri/src/main.rs+++ b/apps/settings/src-tauri/src/main.rs@@ -36,6 +36,12 @@ fn get_config() -> Config {.unwrap_or_default()}+/// The defaults live in `muelle-config`; the window asks for them to reset.+#[tauri::command]+fn default_config() -> Config {+ Config::default()+}+#[tauri::command]fn set_config(config: Config) -> Result<Config, String> {let config = merged_with_disk(config.sanitized());@@ -108,6 +114,7 @@ fn main() {.manage(PendingUpdate::default()).invoke_handler(tauri::generate_handler![get_config,+ default_config,set_config,get_autostart,set_autostart,diff --git a/apps/settings/src/App.tsx b/apps/settings/src/App.tsxindex 6ada43f..00bb5b0 100644--- a/apps/settings/src/App.tsx+++ b/apps/settings/src/App.tsx@@ -2,11 +2,13 @@ import { getVersion } from "@tauri-apps/api/app";import { getCurrentWindow } from "@tauri-apps/api/window";import { useCallback, useEffect, useRef, useState } from "react";import {+ type ActiveAppClick,type Config,type Language,ICON_SIZE,MAX_MAGNIFIED_SIZE,checkUpdate,+ defaultConfig,getAutostart,installUpdate,loadConfig,@@ -31,6 +33,8 @@ type Texts = typeof es;/** Dragging a slider saves at most this often; the dock redraws on each save. */const SAVE_DELAY_MS = 60;+/** How long the reset button stays armed after the first click. */+const RESET_CONFIRM_MS = 4000;function textsFor(language: Language): Texts {const spanish =@@ -45,6 +49,7 @@ export function App() {const [failed, setFailed] = useState(false);const [version, setVersion] = useState("");const [updateState, setUpdateState] = useState<UpdateState>({ kind: "checking" });+ const [confirmingReset, setConfirmingReset] = useState(false);const pending = useRef<Config | null>(null);const timer = useRef<number | undefined>(undefined);@@ -113,6 +118,20 @@ export function App() {installUpdate().catch(() => setUpdateState({ kind: "error" }));}, []);+ // Two clicks: the first arms the button, the second resets. Pinned and+ // recent apps stay; they belong to the user, not to the settings.+ const reset = useCallback(() => {+ if (!confirmingReset) {+ setConfirmingReset(true);+ window.setTimeout(() => setConfirmingReset(false), RESET_CONFIRM_MS);+ return;+ }+ setConfirmingReset(false);+ defaultConfig()+ .then(({ pinned: _pinned, recent: _recent, ...defaults }) => update(defaults))+ .catch(() => setFailed(true));+ }, [confirmingReset, update]);+if (!config) return <div className="window" />;const t = textsFor(config.language);const appWindow = getCurrentWindow();@@ -216,6 +235,40 @@ export function App() {/></Row></Card>+ <Card>+ <Row label={t.showIndicators}>+ <Toggle+ label={t.showIndicators}+ checked={config.showIndicators}+ onChange={(showIndicators) => update({ showIndicators })}+ />+ </Row>+ <Row label={t.showRecents} hint={t.showRecentsHint}>+ <Toggle+ label={t.showRecents}+ checked={config.showRecents}+ onChange={(showRecents) => update({ showRecents })}+ />+ </Row>+ <Row label={t.bounceOnOpen}>+ <Toggle+ label={t.bounceOnOpen}+ checked={config.bounceOnOpen}+ onChange={(bounceOnOpen) => update({ bounceOnOpen })}+ />+ </Row>+ <Row label={t.activeAppClick} hint={t.activeAppClickHint}>+ <Segmented<ActiveAppClick>+ label={t.activeAppClick}+ value={config.activeAppClick}+ options={[+ { value: "minimize", label: t.activeAppMinimize },+ { value: "nothing", label: t.activeAppNothing },+ ]}+ onChange={(activeAppClick) => update({ activeAppClick })}+ />+ </Row>+ </Card></>) : (<>@@ -254,6 +307,17 @@ export function App() {)}</Row></Card>+ <Card>+ <Row label={t.reset} hint={confirmingReset ? t.resetConfirmHint : t.resetHint}>+ <button+ type="button"+ className={confirmingReset ? "push push-danger" : "push"}+ onClick={reset}+ >+ {confirmingReset ? t.resetConfirm : t.resetButton}+ </button>+ </Row>+ </Card></>)}{failed ? (diff --git a/apps/settings/src/config.ts b/apps/settings/src/config.tsindex 6e0732e..390b940 100644--- a/apps/settings/src/config.ts+++ b/apps/settings/src/config.ts@@ -1,6 +1,7 @@import { invoke } from "@tauri-apps/api/core";export type Language = "auto" | "es" | "en";+export type ActiveAppClick = "minimize" | "nothing";/** Mirrors `muelle_config::Config`. */export interface Config {@@ -14,6 +15,10 @@ export interface Config {genie: boolean;menuBar: boolean;menuBarAutoHide: boolean;+ activeAppClick: ActiveAppClick;+ showIndicators: boolean;+ showRecents: boolean;+ bounceOnOpen: boolean;language: Language;}@@ -21,6 +26,7 @@ export const ICON_SIZE = { min: 32, max: 96 } as const;export const MAX_MAGNIFIED_SIZE = 160;export const loadConfig = () => invoke<Config>("get_config");+export const defaultConfig = () => invoke<Config>("default_config");export const saveConfig = (config: Config) => invoke<Config>("set_config", { config });export const getAutostart = () => invoke<boolean>("get_autostart");export const setAutostart = (enabled: boolean) => invoke<void>("set_autostart", { enabled });diff --git a/apps/settings/src/i18n/en.json b/apps/settings/src/i18n/en.jsonindex 26d29fa..3d137a1 100644--- a/apps/settings/src/i18n/en.json+++ b/apps/settings/src/i18n/en.json@@ -28,5 +28,18 @@"updatesInstalling": "Downloading and installing…","updatesError": "Could not check. Check your connection.","updatesCheck": "Check",- "updatesInstall": "Update"+ "updatesInstall": "Update",+ "showIndicators": "Show indicators for open apps",+ "showRecents": "Show recent apps",+ "showRecentsHint": "The last three you opened that are not pinned.",+ "bounceOnOpen": "Animate opening apps",+ "activeAppClick": "Clicking the active app",+ "activeAppClickHint": "Minimize is what the Windows taskbar does; do nothing is what macOS does.",+ "activeAppMinimize": "Minimize",+ "activeAppNothing": "Do nothing",+ "reset": "Restore defaults",+ "resetHint": "Back to the out-of-the-box look and behavior. Your pinned apps stay.",+ "resetConfirmHint": "Click again to confirm.",+ "resetButton": "Restore",+ "resetConfirm": "Confirm"}diff --git a/apps/settings/src/i18n/es.json b/apps/settings/src/i18n/es.jsonindex 2de818b..2a03549 100644--- a/apps/settings/src/i18n/es.json+++ b/apps/settings/src/i18n/es.json@@ -28,5 +28,18 @@"updatesInstalling": "Descargando e instalando…","updatesError": "No se pudo comprobar. Revisa la conexión.","updatesCheck": "Buscar",- "updatesInstall": "Actualizar"+ "updatesInstall": "Actualizar",+ "showIndicators": "Mostrar indicadores de las apps abiertas",+ "showRecents": "Mostrar apps recientes",+ "showRecentsHint": "Las tres últimas que abriste sin tenerlas fijadas.",+ "bounceOnOpen": "Animar al abrir apps",+ "activeAppClick": "Al hacer clic en la app activa",+ "activeAppClickHint": "Minimizar es lo que hace la barra de tareas de Windows; no hacer nada, lo que hace macOS.",+ "activeAppMinimize": "Minimizar",+ "activeAppNothing": "No hacer nada",+ "reset": "Restablecer valores",+ "resetHint": "Vuelve al aspecto y comportamiento de fábrica. Tus apps fijadas se mantienen.",+ "resetConfirmHint": "Pulsa otra vez para confirmar.",+ "resetButton": "Restablecer",+ "resetConfirm": "Confirmar"}diff --git a/apps/settings/src/styles.css b/apps/settings/src/styles.cssindex 96ab4a9..fd5bc2a 100644--- a/apps/settings/src/styles.css+++ b/apps/settings/src/styles.css@@ -270,6 +270,11 @@ input:focus-visible {opacity: 0.5;}+.push-danger {+ background: #ff453a;+ color: #fff;+}+.push-primary {background: var(--accent);color: #fff;diff --git a/crates/muelle-config/src/lib.rs b/crates/muelle-config/src/lib.rsindex eb5d4c4..7311387 100644--- a/crates/muelle-config/src/lib.rs+++ b/crates/muelle-config/src/lib.rs@@ -52,9 +52,27 @@ pub struct Config {pub menu_bar: bool,/// Keep the menu bar off screen until the pointer touches the top edge.pub menu_bar_auto_hide: bool,+ /// What clicking the icon of the app already in front does.+ pub active_app_click: ActiveAppClick,+ /// The dot under apps that have windows open.+ pub show_indicators: bool,+ /// The section of recently used apps that are not pinned.+ pub show_recents: bool,+ /// Icons bounce while the app they open is starting.+ pub bounce_on_open: bool,pub language: Language,}+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]+#[serde(rename_all = "lowercase")]+pub enum ActiveAppClick {+ /// As the Windows taskbar does.+ #[default]+ Minimize,+ /// As macOS does.+ Nothing,+}+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "lowercase")]pub enum Language {@@ -103,6 +121,10 @@ impl Default for Config {genie: false,menu_bar: true,menu_bar_auto_hide: false,+ active_app_click: ActiveAppClick::Minimize,+ show_indicators: true,+ show_recents: true,+ bounce_on_open: true,language: Language::Auto,}}@@ -193,6 +215,31 @@ mod tests {assert_eq!(load(&path).ok(), Some(Some(Config::default())));}+ #[test]+ fn load_should_give_older_files_the_new_behavior_defaults() {+ let path = scratch("before-behavior");+ save(&path, &Config::default()).ok();+ fs::write(&path, r#"{"version":1,"iconSize":56}"#).ok();+ let config = load(&path).ok().flatten().unwrap_or_default();+ assert_eq!(config.icon_size, 56);+ assert_eq!(config.active_app_click, ActiveAppClick::Minimize);+ assert!(config.show_indicators && config.show_recents && config.bounce_on_open);+ }++ #[test]+ fn load_should_read_the_behavior_settings() {+ let path = scratch("behavior");+ save(&path, &Config::default()).ok();+ fs::write(+ &path,+ r#"{"activeAppClick":"nothing","showRecents":false,"bounceOnOpen":false}"#,+ )+ .ok();+ let config = load(&path).ok().flatten().unwrap_or_default();+ assert_eq!(config.active_app_click, ActiveAppClick::Nothing);+ assert!(!config.show_recents && !config.bounce_on_open);+ }+#[test]fn load_should_fail_on_invalid_json() {let path = scratch("invalid");diff --git a/crates/muelle-shell/src/launcher.rs b/crates/muelle-shell/src/launcher.rsindex 2643cf9..67a4e2e 100644--- a/crates/muelle-shell/src/launcher.rs+++ b/crates/muelle-shell/src/launcher.rs@@ -4,13 +4,15 @@ use windows::{Foundation::{HWND, LPARAM, WPARAM},UI::{Input::KeyboardAndMouse::{- INPUT, INPUT_0, INPUT_KEYBOARD, KEYBD_EVENT_FLAGS, KEYBDINPUT, KEYEVENTF_KEYUP,- SendInput, VIRTUAL_KEY, VK_A, VK_LWIN, VK_N,+ INPUT, INPUT_0, INPUT_KEYBOARD, INPUT_MOUSE, KEYBD_EVENT_FLAGS, KEYBDINPUT,+ KEYEVENTF_KEYUP, SendInput, VIRTUAL_KEY, VK_A, VK_LWIN, VK_N,},Shell::ShellExecuteW,WindowsAndMessaging::{- HWND_TOP, IsIconic, PostMessageW, SW_RESTORE, SW_SHOWNORMAL, SWP_NOACTIVATE,- SWP_NOMOVE, SWP_NOSIZE, SetForegroundWindow, SetWindowPos, ShowWindow, WM_CLOSE,+ ASFW_ANY, AllowSetForegroundWindow, GetForegroundWindow, HWND_TOP, IsIconic,+ IsWindowVisible, PostMessageW, SW_MINIMIZE, SW_RESTORE, SW_SHOWNORMAL,+ SWP_NOACTIVATE, SWP_NOMOVE, SWP_NOSIZE, SetForegroundWindow, SetWindowPos,+ ShowWindow, ShowWindowAsync, SwitchToThisWindow, WM_CLOSE,},},},@@ -24,7 +26,18 @@ pub struct LaunchError {code: isize,}+/// The dock never takes the focus, so Windows may refuse the foreground to the+/// app it starts and open it behind other windows. The click that asked for it+/// was the dock's, which lets the dock hand that right on.+fn allow_foreground() {+ // SAFETY: No pointers; failure only means Windows keeps its default.+ unsafe {+ let _ = AllowSetForegroundWindow(ASFW_ANY);+ }+}+pub fn open(id: &str) -> Result<(), LaunchError> {+ allow_foreground();// SAFETY: The strings live for the duration of the call.let result = unsafe {ShellExecuteW(@@ -51,6 +64,7 @@ pub fn open(id: &str) -> Result<(), LaunchError> {/// Opens `files` with the executable `app`.pub fn open_with(app: &str, files: &[String]) -> Result<(), LaunchError> {let arguments: Vec<String> = files.iter().map(|file| format!("\"{file}\"")).collect();+ allow_foreground();// SAFETY: The strings live for the duration of the call.let result = unsafe {ShellExecuteW(@@ -113,6 +127,7 @@ pub fn open_notifications() {pub fn reveal(path: &str) -> Result<(), LaunchError> {let arguments = HSTRING::from(format!("/select,\"{path}\""));+ allow_foreground();// SAFETY: The strings live for the duration of the call.let result = unsafe {ShellExecuteW(@@ -175,7 +190,46 @@ pub fn activate(windows: &[isize]) {};if IsIconic(front).as_bool() {let _ = ShowWindow(front, SW_RESTORE);+ // Windows refuses ShowWindow on an app running as administrator+ // (Task Manager, for one). SwitchToThisWindow, what Alt+Tab uses,+ // restores it anyway and also brings it to the front.+ if IsIconic(front).as_bool() {+ SwitchToThisWindow(front, true);+ }+ }+ bring_to_front(front);+ }+}++/// Gives `hwnd` the focus. Windows only lets the process that received the+/// last input do this; when it refuses (the click was some time ago, or+/// another app grabbed the input since), an empty mouse input makes the dock+/// that process again, and the second attempt succeeds.+unsafe fn bring_to_front(hwnd: HWND) {+ // SAFETY: Calls on another window; they fail without effect if it is gone.+ unsafe {+ if SetForegroundWindow(hwnd).as_bool() && GetForegroundWindow() == hwnd {+ return;+ }+ let nudge = INPUT {+ r#type: INPUT_MOUSE,+ ..Default::default()+ };+ SendInput(&[nudge], size_of::<INPUT>() as i32);+ let _ = SetForegroundWindow(hwnd);+ }+}++/// Minimizes an app's windows, as clicking the active app's taskbar button+/// does. Asynchronous, so an app that is not responding cannot block the dock.+pub fn minimize(windows: &[isize]) {+ for &raw in windows {+ let hwnd = HWND(raw as *mut _);+ // SAFETY: Calls on another window; they fail without effect if it is gone.+ unsafe {+ if IsWindowVisible(hwnd).as_bool() && !IsIconic(hwnd).as_bool() {+ let _ = ShowWindowAsync(hwnd, SW_MINIMIZE);+ }}- let _ = SetForegroundWindow(front);}}diff --git a/spikes/Cargo.toml b/spikes/Cargo.tomlindex e76deea..89a4a8e 100644--- a/spikes/Cargo.toml+++ b/spikes/Cargo.toml@@ -30,6 +30,8 @@ windows = { workspace = true, features = ["Win32_System_WinRT","Win32_System_WinRT_Composition","Win32_UI_HiDpi",+ "Win32_UI_Input_KeyboardAndMouse",+ "Win32_System_SystemInformation","Win32_UI_Shell","Win32_UI_WindowsAndMessaging",] }diff --git a/spikes/src/bin/spike_launch.rs b/spikes/src/bin/spike_launch.rsnew file mode 100644index 0000000..0a1afc0--- /dev/null+++ b/spikes/src/bin/spike_launch.rs@@ -0,0 +1,110 @@+//! Checks the dock's launch, activate and minimize paths without a mouse.+//! Usage: spike_launch <exe path> <window title fragment>+//! Waits until the user has been idle for 30 s, because it moves the focus.++use std::{env, thread, time::Duration};++use muelle_shell::launcher;+use windows::Win32::{+ Foundation::HWND,+ System::SystemInformation::GetTickCount,+ UI::{+ Input::KeyboardAndMouse::{GetLastInputInfo, LASTINPUTINFO},+ WindowsAndMessaging::{+ EnumWindows, GetForegroundWindow, GetWindowTextW, IsIconic, IsWindowVisible,+ },+ },+};+use windows::core::BOOL;++fn idle_ms() -> u32 {+ let mut info = LASTINPUTINFO {+ cbSize: size_of::<LASTINPUTINFO>() as u32,+ dwTime: 0,+ };+ // SAFETY: `info` has its size set and lives for the call.+ unsafe {+ let _ = GetLastInputInfo(&mut info);+ GetTickCount().wrapping_sub(info.dwTime)+ }+}++fn find(fragment: &str) -> Option<HWND> {+ unsafe extern "system" fn collect(+ hwnd: HWND,+ list: windows::Win32::Foundation::LPARAM,+ ) -> BOOL {+ // SAFETY: `list` is the Vec below, alive for the synchronous enumeration.+ unsafe { (*(list.0 as *mut Vec<HWND>)).push(hwnd) };+ true.into()+ }+ let mut all: Vec<HWND> = Vec::new();+ // SAFETY: The Vec outlives EnumWindows.+ unsafe {+ let _ = EnumWindows(+ Some(collect),+ windows::Win32::Foundation::LPARAM(&raw mut all as isize),+ );+ }+ let needle = fragment.to_lowercase();+ all.into_iter().find(|&hwnd| {+ let mut buffer = [0u16; 256];+ // SAFETY: Read-only queries.+ let len = unsafe { GetWindowTextW(hwnd, &mut buffer) };+ let title = String::from_utf16_lossy(&buffer[..len.max(0) as usize]).to_lowercase();+ let visible = unsafe { IsWindowVisible(hwnd).as_bool() };+ visible && title.contains(&needle)+ })+}++fn report(step: &str, hwnd: HWND) {+ // SAFETY: Read-only queries.+ let (front, iconic) = unsafe { (GetForegroundWindow() == hwnd, IsIconic(hwnd).as_bool()) };+ println!("{step}: foreground={front} minimized={iconic}");+}++fn main() {+ let args: Vec<String> = env::args().skip(1).collect();+ let [exe, fragment] = args.as_slice() else {+ eprintln!("usage: spike_launch <exe> <title fragment>");+ return;+ };+ while idle_ms() < 30_000 {+ thread::sleep(Duration::from_secs(2));+ }++ if let Err(error) = launcher::open(exe) {+ println!("open failed: {error}");+ return;+ }+ let mut hwnd = None;+ for _ in 0..50 {+ thread::sleep(Duration::from_millis(200));+ hwnd = find(fragment);+ if hwnd.is_some() {+ break;+ }+ }+ let Some(hwnd) = hwnd else {+ println!("no window titled like {fragment:?} appeared");+ return;+ };+ thread::sleep(Duration::from_millis(800));+ report("after open", hwnd);++ let raw = hwnd.0 as isize;+ launcher::minimize(&[raw]);+ thread::sleep(Duration::from_millis(800));+ report("after minimize", hwnd);++ launcher::activate(&[raw]);+ thread::sleep(Duration::from_millis(800));+ report("after activate", hwnd);++ launcher::minimize(&[raw]);+ thread::sleep(Duration::from_millis(800));+ report("after second minimize", hwnd);+ launcher::activate(&[raw]);+ thread::sleep(Duration::from_millis(800));+ report("after second activate", hwnd);+}