dbus: Take lid-inhibitor-locks on systemd systems
This commit is contained in:
parent
8648d4450e
commit
f2fc1e9480
5 changed files with 70 additions and 1 deletions
17
src/dbus/logind.rs
Normal file
17
src/dbus/logind.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
use std::os::fd::OwnedFd;
|
||||
|
||||
use logind_zbus::manager::{InhibitType::HandleLidSwitch, ManagerProxyBlocking};
|
||||
use zbus::blocking::Connection;
|
||||
|
||||
pub fn inhibit_lid() -> anyhow::Result<OwnedFd> {
|
||||
let conn = Connection::system()?;
|
||||
let proxy = ManagerProxyBlocking::new(&conn)?;
|
||||
let fd = proxy.inhibit(
|
||||
HandleLidSwitch,
|
||||
"cosmic-comp",
|
||||
"External output connected",
|
||||
"block",
|
||||
)?;
|
||||
|
||||
Ok(fd.into())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue