Simplify code

This commit is contained in:
Jonatan Pettersson 2024-11-18 20:08:01 +01:00
parent 4d3d283f52
commit 0aed16b23c

View file

@ -258,13 +258,11 @@ pub async fn spawn_desktop_exec<S, I, K, V>(
_ => return, _ => return,
}; };
let mut cmd = match terminal { let mut cmd = if terminal {
true => {
let mut cmd = std::process::Command::new("cosmic-term"); let mut cmd = std::process::Command::new("cosmic-term");
cmd.args(vec!["--", format!("{}", &executable).as_str()]); cmd.args(vec!["--", format!("{}", &executable).as_str()]);
cmd cmd
} } else {
false => {
let mut cmd = std::process::Command::new(&executable); let mut cmd = std::process::Command::new(&executable);
for arg in exec { for arg in exec {
// TODO handle "%" args here if necessary? // TODO handle "%" args here if necessary?
@ -273,7 +271,6 @@ pub async fn spawn_desktop_exec<S, I, K, V>(
} }
} }
cmd cmd
}
}; };
cmd.envs(env_vars); cmd.envs(env_vars);