diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-04-16 21:54:54 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-04-16 21:54:54 +0200 |
commit | 102e7d997a40a7215b10686ce2b0d006d5a97c2e (patch) | |
tree | 86449e1b494d7c209563f6870a5c7493528434aa /bin/guiscripts | |
parent | a58ae56e98a8d9fcbe7fc7beaa976a4d164ee99a (diff) | |
parent | 0403da37e183e41d3b949b473038806059130815 (diff) |
Merge branch 'main' of db:dotfiles
Diffstat (limited to 'bin/guiscripts')
-rwxr-xr-x | bin/guiscripts/dmapimg | 22 | ||||
-rwxr-xr-x | bin/guiscripts/dmclip | 6 | ||||
-rwxr-xr-x | bin/guiscripts/dmpassgen | 36 | ||||
-rwxr-xr-x | bin/guiscripts/dmpdf | 5 | ||||
-rwxr-xr-x | bin/guiscripts/dmvid | 16 | ||||
-rwxr-xr-x | bin/guiscripts/dmvol | 12 | ||||
-rwxr-xr-x | bin/guiscripts/mmpcvol | 23 | ||||
-rwxr-xr-x | bin/guiscripts/mplay | 16 |
8 files changed, 106 insertions, 30 deletions
diff --git a/bin/guiscripts/dmapimg b/bin/guiscripts/dmapimg index 3677ed3..151b8d0 100755 --- a/bin/guiscripts/dmapimg +++ b/bin/guiscripts/dmapimg @@ -1,7 +1,17 @@ #!/bin/sh -dest="$XDG_DATA_HOME"/appimages/ -appimage="$(\ - find "$dest" -type f -printf "%f\n" \ - | sed 's/\.[Aa]pp[Ii]mage$//g' \ - | dmenu -x -l 10 -g 1 -p "AppImage:")" -setsid "${dest}/${appimage:-NOSEL}"* + +if [ -z "$MENUCMD" ] +then + menucmd="fzf" +elif [ "$MENUCMD" = "tofi" ] +then + menucmd='tofi --width 700 --height 300 --prompt-text Appimage:' +else + menucmd="dmenu -x -l 10 -g 1 -p Appimage:" +fi + +dest="$XDG_DATA_HOME"/appimages +appimage="$(find "$dest" -type f -printf "%f\n" | + sed 's/\.[Aa]pp[Ii]mage$//g' | + $menucmd)" +setsid "$dest/${appimage:-NOSEL}"* diff --git a/bin/guiscripts/dmclip b/bin/guiscripts/dmclip index a1ca634..cd5c928 100755 --- a/bin/guiscripts/dmclip +++ b/bin/guiscripts/dmclip @@ -11,16 +11,16 @@ NotImage () { selection="$(echo "primary\nclipboard\nswap" | dmenu -l 1 -g 3 -p "selection:")" -if [[ "$selection" == "swap" ]] +if [ "$selection" = "swap" ] then clipboard="$(xclip -o)" xclip -o | xclip -sel c echo -n "$clipboard" | xclip -sel c exit -elif [ "$selection" == "" ] +elif [ "$selection" = "" ] then exit 1 -elif [ "$selection" == "primary" ] +elif [ "$selection" = "primary" ] then selection2="clipboard" else diff --git a/bin/guiscripts/dmpassgen b/bin/guiscripts/dmpassgen index d193998..a60112b 100755 --- a/bin/guiscripts/dmpassgen +++ b/bin/guiscripts/dmpassgen @@ -1,17 +1,44 @@ #!/usr/bin/env sh -choice="$(echo "multiline\nsingle" | dmenu -l 1 -g 2)" + +input () +{ + # menu prompt for output + if [ "$MENUCMD" = "tofi" ] + then + inp="$(tofi --prompt-text "$1 " </dev/null)" + elif [ "$MENUCMD" = "dmenu" ] + then + inp="$(dmenu -p "$1" < /dev/null)" + else + echo -n "$1:" >&2 + read inp + fi + echo $inp +} +# menu select long +if [ "$MENUCMD" = "tofi" ] +then + menucmd="tofi --prompt login:" +elif [ "$MENUCMD" = "dmenu" ] +then + menucmd="dmenu -l 10 -g 1 -x -i -p login:" +else + menucmd="fzf" +fi + +choice="$(echo "multiline\nsingle" | $MENUCMD)" test -z "${choice}" && exit 1 -password="$(dmenu -p "name:" </dev/null)" +password="$(input "name:")" test -z "${password}" && exit 1 if [ "${choice}" = "multiline" ] then login="$(ls -1 ~/.password-store/e-mails | sed 's/\.gpg$//' | - dmenu -g 1 -l 8 -p "login:")" + $menucmd)" test -z "${login}" && exit 1 - url="$(dmenu -p "url:" </dev/null)" + url="$(input "url:")" test -z "${url}" && exit 1 echo "${password}\nlogin: ${login}\nurl: ${url}" | pass insert -mf "${password}" @@ -19,4 +46,3 @@ then else pass generate -cf "${password}" fi - diff --git a/bin/guiscripts/dmpdf b/bin/guiscripts/dmpdf index e8d4601..56356d7 100755 --- a/bin/guiscripts/dmpdf +++ b/bin/guiscripts/dmpdf @@ -6,9 +6,10 @@ choice="$(\ sed 's|^/home/aluc|\~| ; s|\([^/]\)[^/]*/|\1/|g' "$tmp" | awk '{printf "%s %s\n", NR ":", $0}' | dmenu -p "pdf:" -l 10 -g 1 -x -i | - grep -oE "^[0-9]+:")" + grep -oE "^[0-9]+:" | + cut -f1 -d:)" if [ -z "$choice" ]; then exit fi -file="$(sed -n "${choice::-1}p" "$tmp")" +file="$(sed -n "${choice}p" "$tmp")" zathura "$file" & diff --git a/bin/guiscripts/dmvid b/bin/guiscripts/dmvid index 23e2c56..a31a221 100755 --- a/bin/guiscripts/dmvid +++ b/bin/guiscripts/dmvid @@ -1,12 +1,24 @@ #!/usr/bin/env sh -find ${1:-~/vids ~/dl} 2> /dev/null | +dirs="${1:-$HOME/vids $HOME/dl}" +find -L $dirs 2> /dev/null | grep ".\+\.\(webm\|mp4\|mpeg\|mkv\)$" | sort > /tmp/dmvids +cat /tmp/dmvids + +if [ "$MENUCMD" = "tofi" ] +then + menucmd="tofi --width 30% --height 30%" +elif [ "$MENUCMD" = "dmenu" ] +then + menucmd="dmenu -l 10 -g 1 -x -i" +else + menucmd="fzf" +fi choice="$(sed 's|^/home/aluc|\~| ; s|\([^/]\)[^/]*/|\1/|g' /tmp/dmvids | awk '{printf "%s %s\n", NR ":", $0}' | - dmenu -l 10 -g 1 -x -i | + $menucmd | cut -f 1 -d ':')" test -z "$choice" && exit 1 diff --git a/bin/guiscripts/dmvol b/bin/guiscripts/dmvol deleted file mode 100755 index 8909de7..0000000 --- a/bin/guiscripts/dmvol +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -while true -do - volume="$(mpc volume | awk '{print $2}' | cut -f1 -d'%')" - choice="$(echo "plus\nmin" | - dmenu -g 2 -l 1 -p "$volume" | - sed 's/plus/+/;s/min/-/')" - test -z "$choice" && break - nb="$(dmenu -g 2 -l 1 -p "$volume$choice" < /dev/null)" - test -z "$nb" && break - mpc volume "$choice$nb" -done diff --git a/bin/guiscripts/mmpcvol b/bin/guiscripts/mmpcvol new file mode 100755 index 0000000..0f36e18 --- /dev/null +++ b/bin/guiscripts/mmpcvol @@ -0,0 +1,23 @@ +#!/bin/sh + +if [ "$MENUCMD" = "tofi" ] +then + menucmd="tofi --width 5% --height 10% --prompt-text" +elif [ "$MENUCMD" = "dmenu" ] +then + menucmd="dmenu -g 2 -l 1 -p" +else + menucmd="fzf --prompt" +fi + +while true +do + volume="$(mpc volume | awk '{print $2}' | cut -f1 -d'%')" + choice="$(echo "plus\nmin" | + $menucmd "$volume" | + sed 's/plus/+/;s/min/-/')" + test -z "$choice" && break + nb="$($menucmd "$volume$choice" < /dev/null)" + test -z "$nb" && break + mpc volume "$choice$nb" +done diff --git a/bin/guiscripts/mplay b/bin/guiscripts/mplay new file mode 100755 index 0000000..4c991fa --- /dev/null +++ b/bin/guiscripts/mplay @@ -0,0 +1,16 @@ +#!/bin/sh +# menu select long +if [ "$MENUCMD" = "tofi" ] +then + menucmd="tofi --width 50% --height 30%" +elif [ "$MENUCMD" = "dmenu" ] +then + menucmd="dmenu -l 10 -g 1 -x -i" +else + menucmd="fzf" +fi +choice="$(mpc listall | $menucmd)" +test -z "$choice" && + exit 1 +mpc insert "$choice" && + mpc next |