diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-10-09 18:37:43 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-10-09 18:37:43 +0400 |
| commit | 189d1bd97b7aa241b5ad651145ca4d3ef483f505 (patch) | |
| tree | dc48204a57c51c6ec57de7d174d60b972b16e39c /src/input.rs | |
| parent | d91d5d674c5b456d25f2e865b28d99aa57f4db4f (diff) | |
| download | niri-189d1bd97b7aa241b5ad651145ca4d3ef483f505.tar.gz niri-189d1bd97b7aa241b5ad651145ca4d3ef483f505.tar.bz2 niri-189d1bd97b7aa241b5ad651145ca4d3ef483f505.zip | |
Add power-off-monitors bind
Implements https://github.com/YaLTeR/niri/issues/24
Diffstat (limited to 'src/input.rs')
| -rw-r--r-- | src/input.rs | 10 |
1 files changed, 10 insertions, 0 deletions
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(); } |
