From ae1ecbf6c5470fd183d0f54f90d3164e5b7858b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Mon, 3 Aug 2026 04:38:20 +0300 Subject: [PATCH] Add input.disable-monitor-wake option By default, any input powers monitors back on after power-off-monitors. When this flag is set, monitors stay off until an explicit power-on-monitors action, e.g. from a key bind. This matches behavior available in other compositors (Hyprland's mouse_move_enables_dpms/key_press_enables_dpms). --- docs/wiki/Configuration:-Input.md | 22 ++++++++++++++++++++++ niri-config/src/input.rs | 4 ++++ niri-config/src/lib.rs | 2 ++ src/input/mod.rs | 4 +++- 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/docs/wiki/Configuration:-Input.md b/docs/wiki/Configuration:-Input.md index af645910..972153bd 100644 --- a/docs/wiki/Configuration:-Input.md +++ b/docs/wiki/Configuration:-Input.md @@ -314,6 +314,28 @@ input { } ``` +#### `disable-monitor-wake` + +Since: next release + +By default, when monitors are powered off (for example, with the `power-off-monitors` action), any input like moving the mouse or pressing a key powers them back on. + +Set this flag to keep the monitors off regardless of input. +Then, the only way to power them back on is the `power-on-monitors` action, for example bound to a key or invoked with `niri msg action power-on-monitors`. + +Keep in mind that other input keeps working normally while the monitors are off: keys will go to the focused window, and binds will trigger their actions. + +```kdl +input { + disable-monitor-wake +} + +binds { + Mod+Shift+P { power-off-monitors; } + Mod+Shift+O { power-on-monitors; } +} +``` + #### `warp-mouse-to-focus` Makes the mouse warp to newly focused windows. diff --git a/niri-config/src/input.rs b/niri-config/src/input.rs index 9d2c0014..696d5219 100644 --- a/niri-config/src/input.rs +++ b/niri-config/src/input.rs @@ -24,6 +24,7 @@ pub struct Input { pub tablet: Tablet, pub touch: Touch, pub disable_power_key_handling: bool, + pub disable_monitor_wake: bool, pub warp_mouse_to_focus: Option, pub focus_follows_mouse: Option, pub workspace_auto_back_and_forth: bool, @@ -50,6 +51,8 @@ pub struct InputPart { #[knuffel(child)] pub disable_power_key_handling: Option, #[knuffel(child)] + pub disable_monitor_wake: Option, + #[knuffel(child)] pub warp_mouse_to_focus: Option, #[knuffel(child)] pub focus_follows_mouse: Option, @@ -67,6 +70,7 @@ impl MergeWith for Input { (self, part), keyboard, disable_power_key_handling, + disable_monitor_wake, workspace_auto_back_and_forth, ); diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs index fad654b3..ab2ba4a6 100644 --- a/niri-config/src/lib.rs +++ b/niri-config/src/lib.rs @@ -1221,6 +1221,7 @@ mod tests { } disable-power-key-handling + disable-monitor-wake warp-mouse-to-focus focus-follows-mouse @@ -1633,6 +1634,7 @@ mod tests { ), }, disable_power_key_handling: true, + disable_monitor_wake: true, warp_mouse_to_focus: Some( WarpMouseToFocus { mode: None, diff --git a/src/input/mod.rs b/src/input/mod.rs index c2227b7e..d5ad5921 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -164,7 +164,9 @@ impl State { } } else { // Power on monitors if they were off. - if should_activate_monitors(&event) { + if !self.niri.config.borrow().input.disable_monitor_wake + && should_activate_monitors(&event) + { self.niri.activate_monitors(&mut self.backend); // Notify the idle-notifier of activity only if we're also powering on the