diff options
| author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-04-19 00:51:39 +0200 | 
|---|---|---|
| committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-04-19 00:52:00 +0200 | 
| commit | a2081449840a2d8f47bb3710ff8745a4d9b06733 (patch) | |
| tree | a8c69df157a5b2fe86ad1e066bfc68d4cef25322 | |
| parent | 3c5941df55d843dacf6378317747ed59fe249a5d (diff) | |
made dmhelp MENUCMD sensible
| -rwxr-xr-x | bin/guiscripts/dmhelp | 44 | 
1 files changed, 25 insertions, 19 deletions
diff --git a/bin/guiscripts/dmhelp b/bin/guiscripts/dmhelp index 6199c21..a9027ef 100755 --- a/bin/guiscripts/dmhelp +++ b/bin/guiscripts/dmhelp @@ -1,26 +1,32 @@  #!/usr/bin/env sh -program="${1:-$(dmenu_path | dmenu -l 4 -g 5)}" -opfil="/tmp/dmh_options.txt" -test -z "${program}" && exit 1 +OPTIONS="/tmp/dmh_options.txt" -if ${program} --help > "${opfil}" +if [ "$MENUCMD" = "tofi" ]  then -    option="$(\ -        grep -E "^ *-[-a-Z]* " "${opfil}" \ -            | tr -s ' ' \ -            | sort | uniq \ -            | column -l 2 -t \ -            | dmenu -x -l 20 -g 1 -p "${program}" \ -            | awk '{print $1}' \ -    )" -elif man $program > "${opfil}" +	program="$(tofi-run --prompt-text "program: ")" +	menucmd="tofi --width 50% --height 30% --matching-algorithm normal --prompt-text $program:" +elif [ "$MENUCMD" = "dmenu" ]  then -    echo lesgo +	program="$(dmenu_path | dmenu -l 4 -g 5 -p "program:")"  +	menucmd="dmenu -l 20 -g 1 -x -i -p $program:"   else -    echo "No options found for '${program}'" > /dev/stderr -    exit 1 +	program="$(dmenu_path | fzf)" +	menucmd="fzf"  fi -test -z "${option}" && exit 1 -rm -f "${opfil}" -${program} ${option} +test -z "${program}" && exit 1 + +if $program --help > "$OPTIONS" +then +    option="$(grep -E "^ *-[-a-Z]* " "$OPTIONS" | +		tr -s ' ' | +		sort | +		uniq | +		column -l 2 -t | +		$menucmd | +		awk '{print $1}')" + +test -z "$option" && exit 1 + +rm -f "$OPTIONS" +setsid $program $option  | 
