summaryrefslogtreecommitdiff
path: root/private_dot_local/bin/executable_menu-drun
diff options
context:
space:
mode:
Diffstat (limited to 'private_dot_local/bin/executable_menu-drun')
-rw-r--r--private_dot_local/bin/executable_menu-drun23
1 files changed, 23 insertions, 0 deletions
diff --git a/private_dot_local/bin/executable_menu-drun b/private_dot_local/bin/executable_menu-drun
new file mode 100644
index 0000000..e655672
--- /dev/null
+++ b/private_dot_local/bin/executable_menu-drun
@@ -0,0 +1,23 @@
1#!/bin/sh
2
3SEARCH_PATHS=$(echo $XDG_DATA_HOME:$XDG_DATA_DIRS | tr ':' '\n' | awk '{print $1 "/applications"}')
4
5LIST=$(find -L $SEARCH_PATHS -maxdepth 1 -name "*.desktop" -print0 2>/dev/null | xargs -0 awk -F'=' '
6 BEGINFILE { name=""; section="" }
7 /^\[Desktop Entry\]/ { section="main" }
8 /^\[Desktop Action / { section=substr($0, 17, length($0)-17) }
9 /^Name=/ && section=="main" { name=$2 }
10 ENDFILE {
11 if (name != "") {
12 printf "%s:%s\n", FILENAME, name
13 }
14 }
15')
16
17CHOICE=$(echo "$LIST" | cut -d: -f2 | sort -u | $MENU "$@")
18
19[ -z "$CHOICE" ] && exit
20
21FILE=$(echo "$LIST" | grep -F ":$CHOICE" | head -n 1 | cut -d: -f1)
22
23gtk4-launch $(basename $FILE)