Expand description
Blur-dismiss state and generic window-lifecycle event helpers.
A launcher-style window commonly wants two behaviors: hide (rather than
quit) when the user clicks the close button, and optionally hide when it
loses focus (“click away to dismiss”). This module owns the runtime gate
and decision logic; the app wires it into on_window_event.
Structs§
- Blur
Dismiss State - Runtime gate for blur-dismiss, toggled at runtime (e.g. while a result or settings view is open, the app may want to suppress hide-on-blur so resizing or copying from another window doesn’t make it vanish).
Functions§
- handle_
close_ requested WindowEvent::CloseRequestedhandler: prevent the actual close and hide the window instead, so the app keeps running in the tray.- handle_
focus_ lost WindowEvent::Focused(false)handler: hidewindowwhenshould_hide_on_blurallows it.hide_on_blur_prefis the caller’s product-owned settings value (not this crate’s concern).- handle_
focus_ lost_ from_ managed_ state - Convenience: fetch
state’sBlurDismissStatefromwindow’sAppHandleand callhandle_focus_lost. Requiresstateto have been registered viaapp.manage(BlurDismissState::default())(or similar). - should_
hide_ on_ blur - Decide whether a focus-lost event should hide the window: both the
runtime gate (
blur_dismiss_enabled, fromBlurDismissState::enabled) and the user’s persisted preference (hide_on_blur_pref, product-owned settings) must allow it.