Add script to open .desktop application

This commit is contained in:
ItsDrike 2021-07-15 22:23:40 +02:00
parent f5980c3e1a
commit b67f74d539
No known key found for this signature in database
GPG key ID: B5F6B41F708C3ADD

View file

@ -0,0 +1,11 @@
#!/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')
# Run the exec line of the application in the background
$($cmd) &