blob: e03222b3b85ba1a1e9efdd8d83203b4af6c02fb4 (
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
30
31
32
33
|
#!/usr/bin/env sh
OPTIONS="/tmp/dmh_options.txt"
if [ "$MENUCMD" = "tofi" ]
then
program="$(tofi-run --prompt-text "program: ")"
menucmd="tofi --width 50% --height 30% --matching-algorithm normal --prompt-text $program:"
elif [ "$MENUCMD" = "dmenu" ]
then
program="$(dmenu_path | dmenu -l 4 -g 5 -p "program:")"
menucmd="dmenu -l 20 -g 1 -x -i -p $program:"
else
program="$(dmenu_path | fzf)"
menucmd="fzf"
fi
test -z "$program" && exit 1
if $program --help > "$OPTIONS"
then
option="$(grep "^ *-[-a-zA-Z0-9]* " "$OPTIONS" |
tr -s ' ' |
sort |
uniq |
column -l 2 -t |
$menucmd |
awk '{print $1}')"
fi
test -z "$option" && exit 1
rm -f "$OPTIONS"
setsid $program $option
|