2022-07-12 11:55:53 -04:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
|
|
2022-07-15 10:58:28 -04:00
|
|
|
use color_eyre::{eyre::WrapErr, Result};
|
2022-07-20 08:05:19 -07:00
|
|
|
use systemd_client::manager::SystemdManagerProxy;
|
2022-07-12 11:55:53 -04:00
|
|
|
|
|
|
|
|
pub async fn start_systemd_target() -> Result<()> {
|
2022-07-20 08:05:19 -07:00
|
|
|
let connection = zbus::Connection::session().await?;
|
|
|
|
|
let manager = SystemdManagerProxy::new(&connection)
|
2022-07-15 11:06:29 -04:00
|
|
|
.await
|
2022-07-15 10:58:28 -04:00
|
|
|
.wrap_err("failed to connect to org.freedesktop.systemd1.Manager")?;
|
|
|
|
|
manager
|
|
|
|
|
.start_unit("cosmic-session.target", "replace")
|
2022-07-15 11:06:29 -04:00
|
|
|
.await
|
2022-07-15 10:58:28 -04:00
|
|
|
.wrap_err("failed to start cosmic-session.target")?;
|
|
|
|
|
Ok(())
|
2022-07-12 11:55:53 -04:00
|
|
|
}
|