mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
added power-on-monitors (#723)
This commit is contained in:
@@ -1068,6 +1068,7 @@ pub enum Action {
|
|||||||
ChangeVt(i32),
|
ChangeVt(i32),
|
||||||
Suspend,
|
Suspend,
|
||||||
PowerOffMonitors,
|
PowerOffMonitors,
|
||||||
|
PowerOnMonitors,
|
||||||
ToggleDebugTint,
|
ToggleDebugTint,
|
||||||
DebugToggleOpaqueRegions,
|
DebugToggleOpaqueRegions,
|
||||||
DebugToggleDamage,
|
DebugToggleDamage,
|
||||||
@@ -1182,6 +1183,7 @@ impl From<niri_ipc::Action> for Action {
|
|||||||
match value {
|
match value {
|
||||||
niri_ipc::Action::Quit { skip_confirmation } => Self::Quit(skip_confirmation),
|
niri_ipc::Action::Quit { skip_confirmation } => Self::Quit(skip_confirmation),
|
||||||
niri_ipc::Action::PowerOffMonitors {} => Self::PowerOffMonitors,
|
niri_ipc::Action::PowerOffMonitors {} => Self::PowerOffMonitors,
|
||||||
|
niri_ipc::Action::PowerOnMonitors {} => Self::PowerOnMonitors,
|
||||||
niri_ipc::Action::Spawn { command } => Self::Spawn(command),
|
niri_ipc::Action::Spawn { command } => Self::Spawn(command),
|
||||||
niri_ipc::Action::DoScreenTransition { delay_ms } => Self::DoScreenTransition(delay_ms),
|
niri_ipc::Action::DoScreenTransition { delay_ms } => Self::DoScreenTransition(delay_ms),
|
||||||
niri_ipc::Action::Screenshot {} => Self::Screenshot,
|
niri_ipc::Action::Screenshot {} => Self::Screenshot,
|
||||||
|
|||||||
@@ -132,6 +132,8 @@ pub enum Action {
|
|||||||
},
|
},
|
||||||
/// Power off all monitors via DPMS.
|
/// Power off all monitors via DPMS.
|
||||||
PowerOffMonitors {},
|
PowerOffMonitors {},
|
||||||
|
/// Power on all monitors via DPMS.
|
||||||
|
PowerOnMonitors {},
|
||||||
/// Spawn a command.
|
/// Spawn a command.
|
||||||
Spawn {
|
Spawn {
|
||||||
/// Command to spawn.
|
/// Command to spawn.
|
||||||
|
|||||||
+9
-1
@@ -479,6 +479,9 @@ impl State {
|
|||||||
Action::PowerOffMonitors => {
|
Action::PowerOffMonitors => {
|
||||||
self.niri.deactivate_monitors(&mut self.backend);
|
self.niri.deactivate_monitors(&mut self.backend);
|
||||||
}
|
}
|
||||||
|
Action::PowerOnMonitors => {
|
||||||
|
self.niri.activate_monitors(&mut self.backend);
|
||||||
|
}
|
||||||
Action::ToggleDebugTint => {
|
Action::ToggleDebugTint => {
|
||||||
self.backend.toggle_debug_tint();
|
self.backend.toggle_debug_tint();
|
||||||
self.niri.queue_redraw_all();
|
self.niri.queue_redraw_all();
|
||||||
@@ -2582,6 +2585,7 @@ fn allowed_when_locked(action: &Action) -> bool {
|
|||||||
| Action::ChangeVt(_)
|
| Action::ChangeVt(_)
|
||||||
| Action::Suspend
|
| Action::Suspend
|
||||||
| Action::PowerOffMonitors
|
| Action::PowerOffMonitors
|
||||||
|
| Action::PowerOnMonitors
|
||||||
| Action::SwitchLayout(_)
|
| Action::SwitchLayout(_)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -2589,7 +2593,11 @@ fn allowed_when_locked(action: &Action) -> bool {
|
|||||||
fn allowed_during_screenshot(action: &Action) -> bool {
|
fn allowed_during_screenshot(action: &Action) -> bool {
|
||||||
matches!(
|
matches!(
|
||||||
action,
|
action,
|
||||||
Action::Quit(_) | Action::ChangeVt(_) | Action::Suspend | Action::PowerOffMonitors
|
Action::Quit(_)
|
||||||
|
| Action::ChangeVt(_)
|
||||||
|
| Action::Suspend
|
||||||
|
| Action::PowerOffMonitors
|
||||||
|
| Action::PowerOnMonitors
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user