Lock session on screen blanking

This commit is contained in:
Ian Douglas Scott 2024-10-30 13:02:46 -07:00
parent a45b68f0cf
commit 7a20c88896
2 changed files with 15 additions and 0 deletions

View file

@ -137,6 +137,11 @@ impl Dispatch<wl_callback::WlCallback, wl_surface::WlSurface> for State {
.output_power
.set_mode(zwlr_output_power_v1::Mode::Off);
output.fade_surface = None;
// All outputs are done fading
if state.outputs.iter().all(|o| o.fade_surface.is_none()) {
state.fade_done();
}
} else {
fade_surface.update(&state.inner);
}

View file

@ -148,6 +148,16 @@ impl State {
}
}
// Fade surfaces on all outputs have finished fading out
fn fade_done(&mut self) {
if let Some(command) = self
.system_actions
.get(&shortcuts::action::System::LockScreen)
{
crate::run_command(command.to_string());
}
}
fn update_suspend_idle(&mut self, is_idle: bool) {
if is_idle {
// TODO: Make command configurable