dotfiles/home/.local/bin/scripts/deskopen

12 lines
387 B
Plaintext
Raw Permalink Normal View History

#!/bin/sh
# Find the line with exec, if there's multiple lines
# use the last one
exec_line=$(grep '^Exec' "$1" | tail -1)
# Remove 'Exec' and arguments (%u, %f, ...)
cmd=$(echo $exec_line | sed 's/^Exec=//' | sed 's/%.//')
# Remove "" around command (if present)
cmd=$(echo $cmd | sed 's/^"//g' | sed 's/" *$//g')
2021-09-02 15:38:48 +00:00
# Run the exec line of the application using /bin/sh
/bin/sh -c "$cmd"