mirror of
https://codeberg.org/waydeer/layer-shika.git
synced 2026-01-22 09:15:55 +00:00
1.6 KiB
1.6 KiB
Session Lock Selectors Example
This example demonstrates using selectors to configure session lock surfaces with different properties per output. It shows how to set different themes or configurations for lock screens on different monitors.
Key Features
- Creates both a layer shell surface (status bar) and session lock surfaces
- Uses
select_lock()to apply configurations to specific lock surfaces - Demonstrates per-output theming (dark theme on primary output)
- Shows how to handle lock/unlock callbacks with selectors
Selector Usage
// Apply to all lock surfaces
shell.select_lock(Surface::all())
.on_callback_with_args("unlock_requested", handler);
// Apply only to primary output's lock surface
shell.select_lock(Output::Primary)
.set_property("theme", &Value::from("dark"))?;
// Apply to regular layer surface
shell.select(Surface::named("Main"))
.on_callback("lock_requested", handler);
Run
cargo run -p session-lock-selectors
Usage Flow
- Application starts with a status bar showing a "Lock" button
- Click the "Lock" button to activate the session lock
- Lock screens appear on all outputs
- Primary output's lock screen uses dark theme
- Enter any password and click "Unlock" to deactivate
- Application returns to normal mode with status bar
When to Use This Pattern
Use session lock selectors when you need to:
- Configure lock screens differently per output
- Apply different themes or properties to specific monitors
- Handle callbacks consistently across all lock surfaces
- Combine layer shell surfaces with session locks