fix: improve desktop entry field code handling

- The %f and %u field codes may now be expanded within a word
- Handle field code escapes (%%)
- Support the %c and %k field codes

This will notably fix desktop entries and context menu actions
that pass files as a long argument, such as `--option=%f`.
This commit is contained in:
Michael Aaron Murphy 2026-04-24 23:27:33 +02:00
parent d5dbcc7677
commit d775f3e5e8
No known key found for this signature in database
GPG key ID: B2732D4240C9212C
5 changed files with 165 additions and 146 deletions

View file

@ -47,7 +47,7 @@ impl ContextActionPreset {
}
for step in &self.steps {
let Some(commands) = mime_app::exec_to_command(step, paths) else {
let Some(commands) = mime_app::exec_to_command(step, &self.name, None, paths) else {
log::warn!(
"failed to parse context action {:?}: invalid Exec {:?}",
self.name,