From 189d1bd97b7aa241b5ad651145ca4d3ef483f505 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Mon, 9 Oct 2023 18:37:43 +0400 Subject: Add power-off-monitors bind Implements https://github.com/YaLTeR/niri/issues/24 --- src/input.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/input.rs') diff --git a/src/input.rs b/src/input.rs index 955c63f4..c1e335dd 100644 --- a/src/input.rs +++ b/src/input.rs @@ -103,6 +103,13 @@ impl State { // here. self.niri.layout.advance_animations(get_monotonic_time()); + // Power on monitors if they were off. + // HACK: ignore key releases so that the power-off-monitors bind can work. + if !matches!(&event, InputEvent::Keyboard { event } if event.state() == KeyState::Released) + { + self.niri.activate_monitors(&self.backend); + } + let comp_mod = self.backend.mod_key(); match event { @@ -139,6 +146,9 @@ impl State { Action::Suspend => { self.backend.suspend(); } + Action::PowerOffMonitors => { + self.niri.deactivate_monitors(&self.backend); + } Action::ToggleDebugTint => { self.backend.toggle_debug_tint(); } -- cgit