From b67f74d539968f865b5289647ec06efc2b0f7ab2 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 15 Jul 2021 22:23:40 +0200 Subject: [PATCH] Add script to open .desktop application --- home/.local/bin/scripts/deskopen | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 home/.local/bin/scripts/deskopen diff --git a/home/.local/bin/scripts/deskopen b/home/.local/bin/scripts/deskopen new file mode 100755 index 0000000..426928b --- /dev/null +++ b/home/.local/bin/scripts/deskopen @@ -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) &