Getting graphical applications working
This commit is contained in:
parent
b21878d549
commit
46468e8b8e
1 changed files with 10 additions and 4 deletions
14
src/main.rs
14
src/main.rs
|
|
@ -486,14 +486,15 @@ async fn start(
|
||||||
|
|
||||||
let mut dedupe = HashSet::new();
|
let mut dedupe = HashSet::new();
|
||||||
|
|
||||||
let iter = freedesktop_desktop_entry::Iter::new(directories_to_scan);
|
let iter = freedesktop_desktop_entry::Iter::new(directories_to_scan.into_iter());
|
||||||
for entry in iter.entries(None) {
|
let autostart_env = env_vars.clone();
|
||||||
|
for entry in iter.entries::<&str>(None) {
|
||||||
// we've already tried to execute this!
|
// we've already tried to execute this!
|
||||||
if dedupe.contains(&entry.appid) {
|
if dedupe.contains(&entry.appid) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
info!("trying to start appid {} ({})", entry.appid, entry.path);
|
info!("trying to start appid {} ({})", entry.appid, entry.path.display());
|
||||||
|
|
||||||
if let Some(exec_raw) = entry.exec() {
|
if let Some(exec_raw) = entry.exec() {
|
||||||
let mut exec_words = exec_raw.split(" ");
|
let mut exec_words = exec_raw.split(" ");
|
||||||
|
|
@ -510,6 +511,11 @@ async fn start(
|
||||||
let mut command = Command::new(program_name);
|
let mut command = Command::new(program_name);
|
||||||
command.args(args);
|
command.args(args);
|
||||||
|
|
||||||
|
// add relevant envs
|
||||||
|
for (k, v) in &autostart_env {
|
||||||
|
command.env(k, v);
|
||||||
|
}
|
||||||
|
|
||||||
// detach stdin/out/err (should we?)
|
// detach stdin/out/err (should we?)
|
||||||
let child = command
|
let child = command
|
||||||
.stdin(Stdio::null())
|
.stdin(Stdio::null())
|
||||||
|
|
@ -518,7 +524,7 @@ async fn start(
|
||||||
.spawn();
|
.spawn();
|
||||||
|
|
||||||
if let Ok(child) = child {
|
if let Ok(child) = child {
|
||||||
info!("successfully started program {}", entry.appid);
|
info!("successfully started program {} {}", entry.appid, child.id());
|
||||||
dedupe.insert(entry.appid);
|
dedupe.insert(entry.appid);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue