1
0
Fork 0
forked from wry/wry

add dpms on/off command

This commit is contained in:
kossLAN 2026-05-25 21:56:48 -04:00
parent a29937ebe8
commit 2167484861
No known key found for this signature in database
7 changed files with 76 additions and 13 deletions

View file

@ -7,7 +7,8 @@ use {
Backend, BackendConnectorState, BackendConnectorStateSerials, BackendDrmDevice,
BackendEvent, Connector, ConnectorId, ConnectorIds, DrmDeviceId, DrmDeviceIds,
HardwareCursorUpdate, InputDevice, InputDeviceGroupIds, InputDeviceId, InputDeviceIds,
MonitorInfo, transaction::BackendConnectorTransactionError,
MonitorInfo,
transaction::{BackendConnectorTransactionError, ConnectorTransaction},
},
backends::dummy::DummyBackend,
cli::RunArgs,
@ -1404,6 +1405,21 @@ impl State {
}
}
pub fn set_connectors_active(
self: &Rc<Self>,
active: bool,
) -> Result<(), BackendConnectorTransactionError> {
let mut tran = ConnectorTransaction::new(self);
for connector in self.connectors.lock().values() {
let mut state = connector.state.borrow().clone();
state.active = active;
tran.add(&connector.connector, state)?;
}
tran.prepare()?.apply()?.commit();
self.set_backend_idle(!active);
Ok(())
}
pub fn root_visible(&self) -> bool {
!self.idle.backend_idle.get()
}