aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/spawning.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/utils/spawning.rs b/src/utils/spawning.rs
index a6f516db..61912eae 100644
--- a/src/utils/spawning.rs
+++ b/src/utils/spawning.rs
@@ -83,6 +83,16 @@ pub fn spawn<T: AsRef<OsStr> + Send + 'static>(command: Vec<T>, token: Option<Xd
}
}
+/// Spawns the command through the shell.
+///
+/// We hardcode `sh -c`, consistent with other compositors:
+///
+/// - https://github.com/swaywm/sway/blob/b3dcde8d69c3f1304b076968a7a64f54d0c958be/sway/commands/exec_always.c#L64
+/// - https://github.com/hyprwm/Hyprland/blob/1ac1ff457ab8ef1ae6a8f2ab17ee7965adfa729f/src/managers/KeybindManager.cpp#L987
+pub fn spawn_sh(command: String, token: Option<XdgActivationToken>) {
+ spawn(vec![String::from("sh"), String::from("-c"), command], token);
+}
+
fn spawn_sync(
command: impl AsRef<OsStr>,
args: impl IntoIterator<Item = impl AsRef<OsStr>>,