diff options
| author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-04-17 18:55:38 +0200 | 
|---|---|---|
| committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-04-17 19:02:28 +0200 | 
| commit | e1254e11ae320848c2fc6ce329a33db107083b9f (patch) | |
| tree | 49c6257d03d02a31ac78717cfede876ff9fa9dff /bin/menuscripts | |
| parent | ca569f466565dc9d435aa6fd96c1905a12c40216 (diff) | |
moved menuscripts to seperate folder
Diffstat (limited to 'bin/menuscripts')
| -rwxr-xr-x | bin/menuscripts/mapimg | 17 | ||||
| -rwxr-xr-x | bin/menuscripts/mcurs | 22 | ||||
| -rwxr-xr-x | bin/menuscripts/mmpcvol | 23 | ||||
| -rwxr-xr-x | bin/menuscripts/mpassgen | 48 | ||||
| -rwxr-xr-x | bin/menuscripts/mplay | 16 | ||||
| -rwxr-xr-x | bin/menuscripts/mpower | 13 | ||||
| -rwxr-xr-x | bin/menuscripts/mvid | 26 | 
7 files changed, 165 insertions, 0 deletions
diff --git a/bin/menuscripts/mapimg b/bin/menuscripts/mapimg new file mode 100755 index 0000000..151b8d0 --- /dev/null +++ b/bin/menuscripts/mapimg @@ -0,0 +1,17 @@ +#!/bin/sh + +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/menuscripts/mcurs b/bin/menuscripts/mcurs new file mode 100755 index 0000000..089bce4 --- /dev/null +++ b/bin/menuscripts/mcurs @@ -0,0 +1,22 @@ +#!/bin/sh + +if [ "$MENUCMD" = "tofi" ] +then +	menucmd="tofi --width 30% --height 20% --padding-left 2%" +elif [ "$MENUCMD" = "dmenu" ] +then +	menucmd="dmenu -l 10 -g 1 -x -i"  +else +	menucmd="fzf" +fi + +# requirements +which $MENUCMD firefox > /dev/null || +	exit 1 + +choice="$(find ${1:-$HOME/docs/school} | +	grep "Cursus/index.html" 2> /dev/null | +	sed "s;$HOME;~;" | +	$menucmd)" +test -z "$choice" && exit 1 +firefox "$choice" diff --git a/bin/menuscripts/mmpcvol b/bin/menuscripts/mmpcvol new file mode 100755 index 0000000..0f36e18 --- /dev/null +++ b/bin/menuscripts/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/menuscripts/mpassgen b/bin/menuscripts/mpassgen new file mode 100755 index 0000000..a60112b --- /dev/null +++ b/bin/menuscripts/mpassgen @@ -0,0 +1,48 @@ +#!/usr/bin/env sh + +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="$(input "name:")" +test -z "${password}" && exit 1 + +if [ "${choice}" = "multiline" ] +then +	login="$(ls -1 ~/.password-store/e-mails | +		sed 's/\.gpg$//' |  +		$menucmd)" +    test -z "${login}" && exit 1 +    url="$(input "url:")" +    test -z "${url}" && exit 1 +    echo "${password}\nlogin: ${login}\nurl: ${url}" | +		pass insert -mf "${password}" +    pass generate -ci "${password}" +else +    pass generate -cf "${password}" +fi diff --git a/bin/menuscripts/mplay b/bin/menuscripts/mplay new file mode 100755 index 0000000..4c991fa --- /dev/null +++ b/bin/menuscripts/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 diff --git a/bin/menuscripts/mpower b/bin/menuscripts/mpower new file mode 100755 index 0000000..f03fd8e --- /dev/null +++ b/bin/menuscripts/mpower @@ -0,0 +1,13 @@ +#!/bin/sh +if [ "$MENUCMD" = "tofi" ] +then +	menucmd="tofi --width 10% --height 10% --padding-left 2%"  +elif [ "$MENUCMD" = "dmenu" ] +then +	menucmd="dmenu -g 2 -l 1" +else +	menucmd="fzf" +fi + +choice="$(echo "poweroff\nreboot\nhibernate" | $menucmd)" +test -z "$choice" || doas "$choice" diff --git a/bin/menuscripts/mvid b/bin/menuscripts/mvid new file mode 100755 index 0000000..a31a221 --- /dev/null +++ b/bin/menuscripts/mvid @@ -0,0 +1,26 @@ +#!/usr/bin/env sh + +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}' |  +	$menucmd |  +	cut -f 1 -d ':')" +test -z "$choice" && +	exit 1 + +mpv "$(sed -n "${choice}p" /tmp/dmvids)"  | 
