summaryrefslogtreecommitdiff
path: root/bin/menuscripts
diff options
context:
space:
mode:
Diffstat (limited to 'bin/menuscripts')
-rwxr-xr-xbin/menuscripts/mapimg17
-rwxr-xr-xbin/menuscripts/mcurs22
-rwxr-xr-xbin/menuscripts/mmpcvol23
-rwxr-xr-xbin/menuscripts/mpassgen48
-rwxr-xr-xbin/menuscripts/mplay16
-rwxr-xr-xbin/menuscripts/mpower13
-rwxr-xr-xbin/menuscripts/mvid26
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)"