From a2081449840a2d8f47bb3710ff8745a4d9b06733 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Wed, 19 Apr 2023 00:51:39 +0200 Subject: made dmhelp MENUCMD sensible --- bin/guiscripts/dmhelp | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) (limited to 'bin/guiscripts/dmhelp') 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 -- cgit v1.2.3 From 0e217b38780f15818f90d81ae5476d854e12e60f Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Wed, 19 Apr 2023 00:52:48 +0200 Subject: made dmhelp menu script --- bin/guiscripts/dmhelp | 32 -------------------------------- bin/menuscripts/mhelp | 32 ++++++++++++++++++++++++++++++++ config/hyprland/hypr/binds.conf | 4 ++-- 3 files changed, 34 insertions(+), 34 deletions(-) delete mode 100755 bin/guiscripts/dmhelp create mode 100755 bin/menuscripts/mhelp (limited to 'bin/guiscripts/dmhelp') diff --git a/bin/guiscripts/dmhelp b/bin/guiscripts/dmhelp deleted file mode 100755 index a9027ef..0000000 --- a/bin/guiscripts/dmhelp +++ /dev/null @@ -1,32 +0,0 @@ -#!/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 -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 diff --git a/bin/menuscripts/mhelp b/bin/menuscripts/mhelp new file mode 100755 index 0000000..a9027ef --- /dev/null +++ b/bin/menuscripts/mhelp @@ -0,0 +1,32 @@ +#!/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 -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 diff --git a/config/hyprland/hypr/binds.conf b/config/hyprland/hypr/binds.conf index a84837e..cc3ebf9 100644 --- a/config/hyprland/hypr/binds.conf +++ b/config/hyprland/hypr/binds.conf @@ -78,7 +78,7 @@ bind =, D, exec, dmdsktp bind =, E, exec, dmemoji bind =, F, exec, dmfm bind =, G, exec, mpassgen -bind =, H, exec, dmhelp +bind =, H, exec, mhelp bind =, I, exec, mapimg bind =, L, exec, dmlang bind =, M, exec, mpass @@ -92,7 +92,7 @@ bind = $mainMod, D, exec, dmdsktp bind = $mainMod, E, exec, dmemoji bind = $mainMod, F, exec, dmfm bind = $mainMod, G, exec, mpassgen -bind = $mainMod, H, exec, dmhelp +bind = $mainMod, H, exec, mhelp bind = $mainMod, I, exec, mapimg bind = $mainMod, L, exec, dmlang bind = $mainMod, M, exec, mpass -- cgit v1.2.3