Respect 'Path' desktop entry key

Closes: #1530

XDG desktop entries support an optional key, `Path`, that sets the
current working directory to launch an app in.
This commit is contained in:
Josh Megnauth 2026-01-29 15:49:21 -05:00
parent 055d9e371c
commit b8ee38072f
No known key found for this signature in database
GPG key ID: 70813183462EFAD3

View file

@ -857,7 +857,13 @@ impl App {
Ok(entry) => match entry.exec() {
Some(exec) => match mime_app::exec_to_command(exec, &[] as &[&str; 0]) {
Some(commands) => {
let cwd_opt = entry.desktop_entry("Path");
for mut command in commands {
if let Some(cwd) = cwd_opt {
command.current_dir(cwd);
}
if let Err(err) = spawn_detached(&mut command) {
log::warn!("failed to execute {}: {}", path.display(), err);
}