blob: 7030fbed51b94d7e4f700f11fc7b82271c479283 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/bin/sh
#app_path="/usr/share/applications/"
app_path="$HOME/.local/share/applications/"
scrape_apps() {
grep '^Name=' "$app_path"/*.desktop | exclude | cut -d= -f2-
}
exclude() {
grep -v "Qube Settings\|os\.vm\.debian-11-dvm\|os\.vm\.whonix-ws-16"
}
find_file() {
grep "^Name=$1" "$app_path"/*.desktop | exclude | 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 | sort | wrap_dmenu -p "Run" $*)
[ -z "$choice" ] && exit
file="$(find_file "$choice")"
[ -z "$file" ] && exit
execute_app "$file"
|