summaryrefslogtreecommitdiff
path: root/qubes-dwm-6.2/scripts/dmenu_all
diff options
context:
space:
mode:
Diffstat (limited to 'qubes-dwm-6.2/scripts/dmenu_all')
-rwxr-xr-xqubes-dwm-6.2/scripts/dmenu_all36
1 files changed, 36 insertions, 0 deletions
diff --git a/qubes-dwm-6.2/scripts/dmenu_all b/qubes-dwm-6.2/scripts/dmenu_all
new file mode 100755
index 0000000..e63bf80
--- /dev/null
+++ b/qubes-dwm-6.2/scripts/dmenu_all
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+#app_path="/usr/share/applications/"
+app_path="$HOME/.local/share/applications/"
+
+scrape_apps() {
+ grep '^Name=\|^Exec=' "$app_path"/*.desktop | grep ':Name=' | cut -d= -f2-
+}
+
+exclude() {
+ grep -v "Qube Settings"
+}
+
+tidy() {
+ sed 's/Rxvt Color Unicode Terminal/urxvt/'
+}
+
+untidy() {
+ sed 's/urxvt/Rxvt Color Unicode Terminal/'
+}
+
+find_file() {
+ grep "^Name=$1" "$app_path"/*.desktop | cut -d: -f1
+}
+
+# Expects the contents of a desktop file
+execute_app() {
+ local cmd="$(grep '^Exec=' "$1" | cut -d= -f2-)"
+ eval " $cmd"
+}
+
+choice=$(scrape_apps | exclude | tidy | sort | wrap_dmenu -p "Run" $* | untidy)
+[ -z "$choice" ] && exit
+file="$(find_file "$choice")"
+[ -z "$file" ] && exit
+execute_app "$file" \ No newline at end of file