Skip to content

Commit

Permalink
Simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
jpttrssn committed Nov 18, 2024
1 parent 98f6808 commit 223fa1f
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/desktop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,22 +249,19 @@ pub async fn spawn_desktop_exec<S, I, K, V>(
_ => return,
};

let mut cmd = match terminal {
true => {
let mut cmd = std::process::Command::new("cosmic-term");
cmd.args(vec!["--", format!("{}", &executable).as_str()]);
cmd
}
false => {
let mut cmd = std::process::Command::new(&executable);
for arg in exec {
// TODO handle "%" args here if necessary?
if !arg.starts_with('%') {
cmd.arg(arg);
}
let mut cmd = if terminal {
let mut cmd = std::process::Command::new("cosmic-term");
cmd.args(vec!["--", format!("{}", &executable).as_str()]);
cmd
} else {
let mut cmd = std::process::Command::new(&executable);
for arg in exec {
// TODO handle "%" args here if necessary?
if !arg.starts_with('%') {
cmd.arg(arg);
}
cmd
}
cmd
};

cmd.envs(env_vars);
Expand Down

0 comments on commit 223fa1f

Please sign in to comment.