Make zbus optional under "dbus" feature

This commit is contained in:
Ivan Molodetskikh
2023-10-10 10:25:26 +04:00
parent 9d7fdc4fc0
commit 082d734b2a
5 changed files with 29 additions and 13 deletions
+2
View File
@@ -924,6 +924,7 @@ impl Tty {
}
pub fn suspend(&self) {
#[cfg(feature = "dbus")]
if let Err(err) = suspend() {
warn!("error suspending: {err:?}");
}
@@ -1026,6 +1027,7 @@ fn refresh_interval(mode: DrmMode) -> Duration {
Duration::from_nanos(refresh_interval)
}
#[cfg(feature = "dbus")]
fn suspend() -> anyhow::Result<()> {
let conn = zbus::blocking::Connection::system().context("error connecting to system bus")?;
let manager = logind_zbus::manager::ManagerProxyBlocking::new(&conn)