aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--niri-config/src/lib.rs2
-rw-r--r--niri-ipc/src/lib.rs2
-rw-r--r--src/input/mod.rs10
3 files changed, 13 insertions, 1 deletions
diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs
index bf08e1ba..17ed2440 100644
--- a/niri-config/src/lib.rs
+++ b/niri-config/src/lib.rs
@@ -1068,6 +1068,7 @@ pub enum Action {
ChangeVt(i32),
Suspend,
PowerOffMonitors,
+ PowerOnMonitors,
ToggleDebugTint,
DebugToggleOpaqueRegions,
DebugToggleDamage,
@@ -1182,6 +1183,7 @@ impl From<niri_ipc::Action> for Action {
match value {
niri_ipc::Action::Quit { skip_confirmation } => Self::Quit(skip_confirmation),
niri_ipc::Action::PowerOffMonitors {} => Self::PowerOffMonitors,
+ niri_ipc::Action::PowerOnMonitors {} => Self::PowerOnMonitors,
niri_ipc::Action::Spawn { command } => Self::Spawn(command),
niri_ipc::Action::DoScreenTransition { delay_ms } => Self::DoScreenTransition(delay_ms),
niri_ipc::Action::Screenshot {} => Self::Screenshot,
diff --git a/niri-ipc/src/lib.rs b/niri-ipc/src/lib.rs
index 13365522..b7cfa192 100644
--- a/niri-ipc/src/lib.rs
+++ b/niri-ipc/src/lib.rs
@@ -132,6 +132,8 @@ pub enum Action {
},
/// Power off all monitors via DPMS.
PowerOffMonitors {},
+ /// Power on all monitors via DPMS.
+ PowerOnMonitors {},
/// Spawn a command.
Spawn {
/// Command to spawn.
diff --git a/src/input/mod.rs b/src/input/mod.rs
index 7c43c896..70356253 100644
--- a/src/input/mod.rs
+++ b/src/input/mod.rs
@@ -479,6 +479,9 @@ impl State {
Action::PowerOffMonitors => {
self.niri.deactivate_monitors(&mut self.backend);
}
+ Action::PowerOnMonitors => {
+ self.niri.activate_monitors(&mut self.backend);
+ }
Action::ToggleDebugTint => {
self.backend.toggle_debug_tint();
self.niri.queue_redraw_all();
@@ -2582,6 +2585,7 @@ fn allowed_when_locked(action: &Action) -> bool {
| Action::ChangeVt(_)
| Action::Suspend
| Action::PowerOffMonitors
+ | Action::PowerOnMonitors
| Action::SwitchLayout(_)
)
}
@@ -2589,7 +2593,11 @@ fn allowed_when_locked(action: &Action) -> bool {
fn allowed_during_screenshot(action: &Action) -> bool {
matches!(
action,
- Action::Quit(_) | Action::ChangeVt(_) | Action::Suspend | Action::PowerOffMonitors
+ Action::Quit(_)
+ | Action::ChangeVt(_)
+ | Action::Suspend
+ | Action::PowerOffMonitors
+ | Action::PowerOnMonitors
)
}