fn remove_field_codes(exec: &str) -> String {
    let mut result = String::with_capacity(exec.len());
    let mut chars = exec.chars();
    while let Some(char) = chars.next() {
        if char == '%' {
            match chars.next() {
                Some('%') | None => result.push('%'), // '%%' is '%' but escaped. '%\0' is illegal but leave it untouched.
                Some(next) if !next.is_ascii_alphabetic() => {
                    // illegal (not a field code) but leave it untouched
                    result.push('%');
                    result.push(next);
                }
                _ => (), // this is a field code, remove it by not pushing it
            }
        } else {
            result.push(char); // "normal" character, leave it untouched
        }
    }
    result
}
Removes [field codes](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables) from exec string

When encountering % at the end of the string or followed by non-alphabetic and non-% character
the function leaves it unmodified in order to be more resilient.
According to the spec, the input should be unquoted first (but this is not implemented currently).
leftwm-core/src/utils/child_process.rs