forge
Explore
Log in

Don't you dare go Hollow

Add input.disable-monitor-wake option

Browse files at this commit

ae1ecbf6c5470fd183d0f54f90d3164e5b7858b0Ahmet Kaan GümüşParent: a8562a1
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.mdmodified+22 -0
@@ -314,6 +314,28 @@ input {
314314 }
315315 ```
316316
317+#### `disable-monitor-wake`
318+
319+<sup>Since: next release</sup>
320+
321+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.
322+
323+Set this flag to keep the monitors off regardless of input.
324+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`.
325+
326+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.
327+
328+```kdl
329+input {
330+ disable-monitor-wake
331+}
332+
333+binds {
334+ Mod+Shift+P { power-off-monitors; }
335+ Mod+Shift+O { power-on-monitors; }
336+}
337+```
338+
317339 #### `warp-mouse-to-focus`
318340
319341 Makes the mouse warp to newly focused windows.
niri-config/src/input.rsmodified+4 -0
@@ -24,6 +24,7 @@ pub struct Input {
2424 pub tablet: Tablet,
2525 pub touch: Touch,
2626 pub disable_power_key_handling: bool,
27+ pub disable_monitor_wake: bool,
2728 pub warp_mouse_to_focus: Option<WarpMouseToFocus>,
2829 pub focus_follows_mouse: Option<FocusFollowsMouse>,
2930 pub workspace_auto_back_and_forth: bool,
@@ -50,6 +51,8 @@ pub struct InputPart {
5051 #[knuffel(child)]
5152 pub disable_power_key_handling: Option<Flag>,
5253 #[knuffel(child)]
54+ pub disable_monitor_wake: Option<Flag>,
55+ #[knuffel(child)]
5356 pub warp_mouse_to_focus: Option<WarpMouseToFocus>,
5457 #[knuffel(child)]
5558 pub focus_follows_mouse: Option<FocusFollowsMouse>,
@@ -67,6 +70,7 @@ impl MergeWith<InputPart> for Input {
6770 (self, part),
6871 keyboard,
6972 disable_power_key_handling,
73+ disable_monitor_wake,
7074 workspace_auto_back_and_forth,
7175 );
7276
niri-config/src/lib.rsmodified+2 -0
@@ -1221,6 +1221,7 @@ mod tests {
12211221 }
12221222
12231223 disable-power-key-handling
1224+ disable-monitor-wake
12241225
12251226 warp-mouse-to-focus
12261227 focus-follows-mouse
@@ -1633,6 +1634,7 @@ mod tests {
16331634 ),
16341635 },
16351636 disable_power_key_handling: true,
1637+ disable_monitor_wake: true,
16361638 warp_mouse_to_focus: Some(
16371639 WarpMouseToFocus {
16381640 mode: None,
src/input/mod.rsmodified+3 -1
@@ -164,7 +164,9 @@ impl State {
164164 }
165165 } else {
166166 // Power on monitors if they were off.
167- if should_activate_monitors(&event) {
167+ if !self.niri.config.borrow().input.disable_monitor_wake
168+ && should_activate_monitors(&event)
169+ {
168170 self.niri.activate_monitors(&mut self.backend);
169171
170172 // Notify the idle-notifier of activity only if we're also powering on the