Open RampedIndent opened 1 year ago
No direct way: you’ll need something like
std::process::Comand::from(cmd!(…)).spawn()
for that effect.
we probably should addd spawn though, to add structured concurrency
Ended up using rayon to do it
#[derive(Debug, Clone, Serialize, Deserialize)] // we'll be cloning it later on
pub struct DispConfig {
display: String,
bar_name: String,
}
#[derive(Clone, Debug)] // we'll be cloning it later on
#[derive(Serialize, Deserialize)] // we'll be cloning it later on
struct ComputerConfig {
displays: Vec<DispConfig>,
}
let monitors = IntoParallelIterator::into_par_iter(computer.displays.clone());
rayon::spawn(move || {
monitors
.filter(|monitor| !monitor.bar_name.is_empty())
.try_for_each(|monitor| {
let sh = Shell::new()?;
let display = monitor.display;
info!("{display:?}");
let barname = monitor.bar_name;
let config = "~/.config/polybar/config.ini";
cmd!(sh, "polybar --reload {barname} -c {config}")
.env("MONITOR", display)
// .env("FC_DEBUG", "1")
.run()?;
anyhow::Ok(())
});
});
So i am trying to rewrite my polybar launch script in rust, in basg you can for a command to the background with the & symbol like so
Is there a way to do this with xshell?