pub struct SessionLock { /* private fields */ }Expand description
A lock screen: while locked is true, the compositor shows only its
surfaces, one covering each output, and nothing else gets input. Lock
with cx.session_lock from the crabshell crate. Every property
takes a value or a closure.
use crabshell_ui::{Color, SessionLock, Style, Text};
let lock = SessionLock::new()
.locked(true)
.style(Style::new().background(Color::rgb(0, 0, 0)))
.surface(|_cx, output| Text::new(format!("locked on {}", output.name())));Implementations§
Source§impl SessionLock
impl SessionLock
Sourcepub fn new() -> SessionLock
pub fn new() -> SessionLock
A lock that never locks, with nothing on its surfaces.
Sourcepub fn locked(self, locked: impl IntoProp<bool>) -> SessionLock
pub fn locked(self, locked: impl IntoProp<bool>) -> SessionLock
Sets whether the session is locked. Turning it false unlocks, as after the user’s password was checked.
Sourcepub fn style(self, style: impl IntoProp<Style>) -> SessionLock
pub fn style(self, style: impl IntoProp<Style>) -> SessionLock
Sets the style of every output’s surface. Its color and font are
inherited by every Text on them that doesn’t set its
own.
Sourcepub fn surface<W: Widget>(
self,
build: impl Fn(&Cx, &Output) -> W + 'static,
) -> SessionLock
pub fn surface<W: Widget>( self, build: impl Fn(&Cx, &Output) -> W + 'static, ) -> SessionLock
Sets what each output’s surface shows: build runs for every output
while the session locks, and for each output added while it is
locked, under a context that goes with that surface.
Sourcepub fn on_key(
self,
handler: impl Fn(&Cx, &KeyEvent) -> bool + 'static,
) -> SessionLock
pub fn on_key( self, handler: impl Fn(&Cx, &KeyEvent) -> bool + 'static, ) -> SessionLock
Runs handler with every key a surface’s focused field or button
didn’t use, as PanelWindow::on_key
does, with that surface’s context; it returns true when it used
the key. Escape clearing the password field is the usual one. A
handler that panics is logged with the surface’s path, such as
SessionLock[DP-1].on_key, and that surface’s stops running it.