✨ Add start-cosmic script; cosmic-session.target
This commit is contained in:
parent
7be35d6153
commit
bc07650f01
6 changed files with 74 additions and 2 deletions
28
src/systemd.rs
Normal file
28
src/systemd.rs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use color_eyre::{
|
||||
eyre::{eyre, WrapErr},
|
||||
Result,
|
||||
};
|
||||
use tokio::process::Command;
|
||||
|
||||
pub async fn start_systemd_target() -> Result<()> {
|
||||
let output = Command::new("systemctl")
|
||||
.arg("--user")
|
||||
.arg("start")
|
||||
.arg("cosmic-session.target")
|
||||
.spawn()
|
||||
.wrap_err("failed to start systemd target")?
|
||||
.wait()
|
||||
.await
|
||||
.wrap_err("failed to wait for systemd target to start")?;
|
||||
|
||||
if output.success() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(eyre!(
|
||||
"failed to start systemd target: code {}",
|
||||
output.code().unwrap_or(-1),
|
||||
))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue