aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2025-08-20 14:31:34 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2025-08-20 14:43:50 +0300
commite81f356908fe38ec45c74cf822dd102efbcf6457 (patch)
tree5c5263b210a0755f48b1511cc1ff8c2697e095a6 /src/utils
parent1013147ba3154788cb16ffc32b8155fd2008dfa3 (diff)
downloadniri-e81f356908fe38ec45c74cf822dd102efbcf6457.tar.gz
niri-e81f356908fe38ec45c74cf822dd102efbcf6457.tar.bz2
niri-e81f356908fe38ec45c74cf822dd102efbcf6457.zip
Add spawn-sh, spawn-at-startup-sh
Our top 10 most confusing config moments
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>>,