From 3c5b64e6cce9340c1cbae24891640942322f3e85 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Fri, 8 Nov 2024 21:02:50 +0200 Subject: [PATCH] Revert "plugins/applications: fix terminal apps with arguments" This reverts commit 08f3d0bfcb1dfcad66d23a77bf6445f2ec7bd818. Functionality was already present in scrubber.rs --- plugins/applications/src/lib.rs | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/plugins/applications/src/lib.rs b/plugins/applications/src/lib.rs index b29fad5..3dca60f 100644 --- a/plugins/applications/src/lib.rs +++ b/plugins/applications/src/lib.rs @@ -31,16 +31,6 @@ mod scrubber; const SENSIBLE_TERMINALS: &[&str] = &["alacritty", "foot", "kitty", "wezterm", "wterm"]; -// remove arguments since they're not being used -// https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s07.html -fn sanitize_exec(exec: &String) -> String { - exec.replace("%U", "") - .replace("%F", "") - .replace("%u", "") - .replace("%f", "") - .replace(" ", "") -} - #[handler] pub fn handler(selection: Match, state: &State) -> HandleResult { let entry = state @@ -55,18 +45,21 @@ pub fn handler(selection: Match, state: &State) -> HandleResult { }) .unwrap(); - let exec = sanitize_exec(&entry.exec); - if entry.term { match &state.config.terminal { Some(term) => { - if let Err(why) = Command::new(term).arg("-e").arg(&exec).spawn() { + if let Err(why) = Command::new(term).arg("-e").arg(&entry.exec).spawn() { eprintln!("Error running desktop entry: {}", why); } } None => { for term in SENSIBLE_TERMINALS { - if Command::new(term).arg("-e").arg(&exec).spawn().is_ok() { + if Command::new(term) + .arg("-e") + .arg(&entry.exec) + .spawn() + .is_ok() + { break; } }