add dpms on/off command
This commit is contained in:
parent
a29937ebe8
commit
2167484861
7 changed files with 76 additions and 13 deletions
18
src/state.rs
18
src/state.rs
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue