From e1254e11ae320848c2fc6ce329a33db107083b9f Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Mon, 17 Apr 2023 18:55:38 +0200 Subject: moved menuscripts to seperate folder --- bin/guiscripts/mapimg | 17 ----------------- bin/guiscripts/mcurs | 22 ---------------------- bin/guiscripts/mmpcvol | 23 ----------------------- bin/guiscripts/mpassgen | 48 ------------------------------------------------ bin/guiscripts/mplay | 16 ---------------- bin/guiscripts/mpower | 13 ------------- bin/guiscripts/mvid | 26 -------------------------- bin/menuscripts/mapimg | 17 +++++++++++++++++ bin/menuscripts/mcurs | 22 ++++++++++++++++++++++ bin/menuscripts/mmpcvol | 23 +++++++++++++++++++++++ bin/menuscripts/mpassgen | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ bin/menuscripts/mplay | 16 ++++++++++++++++ bin/menuscripts/mpower | 13 +++++++++++++ bin/menuscripts/mvid | 26 ++++++++++++++++++++++++++ stowcmds.sh | 4 ++-- 15 files changed, 167 insertions(+), 167 deletions(-) delete mode 100755 bin/guiscripts/mapimg delete mode 100755 bin/guiscripts/mcurs delete mode 100755 bin/guiscripts/mmpcvol delete mode 100755 bin/guiscripts/mpassgen delete mode 100755 bin/guiscripts/mplay delete mode 100755 bin/guiscripts/mpower delete mode 100755 bin/guiscripts/mvid create mode 100755 bin/menuscripts/mapimg create mode 100755 bin/menuscripts/mcurs create mode 100755 bin/menuscripts/mmpcvol create mode 100755 bin/menuscripts/mpassgen create mode 100755 bin/menuscripts/mplay create mode 100755 bin/menuscripts/mpower create mode 100755 bin/menuscripts/mvid diff --git a/bin/guiscripts/mapimg b/bin/guiscripts/mapimg deleted file mode 100755 index 151b8d0..0000000 --- a/bin/guiscripts/mapimg +++ /dev/null @@ -1,17 +0,0 @@ -#!/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/guiscripts/mcurs b/bin/guiscripts/mcurs deleted file mode 100755 index 089bce4..0000000 --- a/bin/guiscripts/mcurs +++ /dev/null @@ -1,22 +0,0 @@ -#!/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/guiscripts/mmpcvol b/bin/guiscripts/mmpcvol deleted file mode 100755 index 0f36e18..0000000 --- a/bin/guiscripts/mmpcvol +++ /dev/null @@ -1,23 +0,0 @@ -#!/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/mpassgen b/bin/guiscripts/mpassgen deleted file mode 100755 index a60112b..0000000 --- a/bin/guiscripts/mpassgen +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env sh - -input () -{ - # menu prompt for output - if [ "$MENUCMD" = "tofi" ] - then - inp="$(tofi --prompt-text "$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/guiscripts/mplay b/bin/guiscripts/mplay deleted file mode 100755 index 4c991fa..0000000 --- a/bin/guiscripts/mplay +++ /dev/null @@ -1,16 +0,0 @@ -#!/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/guiscripts/mpower b/bin/guiscripts/mpower deleted file mode 100755 index f03fd8e..0000000 --- a/bin/guiscripts/mpower +++ /dev/null @@ -1,13 +0,0 @@ -#!/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/guiscripts/mvid b/bin/guiscripts/mvid deleted file mode 100755 index a31a221..0000000 --- a/bin/guiscripts/mvid +++ /dev/null @@ -1,26 +0,0 @@ -#!/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)" 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 " &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)" diff --git a/stowcmds.sh b/stowcmds.sh index 4b6eb13..6583ee5 100755 --- a/stowcmds.sh +++ b/stowcmds.sh @@ -21,14 +21,14 @@ fi case "$MACH" in "desktop" | "d" | "laptop" | "l") mkdir -p "$HOME/bin" - stow -d bin/ -t "$HOME/bin" -R common guiscripts extra + stow -d bin/ -t "$HOME/bin" -R common guiscripts menuscripts extra mkdir -p "$HOME/.config" stow -d config/ -t "$HOME/.config" -R essentials common extra X theme xdg hyprland stow -d config/ -t "$HOME/" -R home ;; "server" | "s") mkdir -p "$HOME/bin" - stow -d bin/ -t "$HOME/bin" -R common serverscripts + stow -d bin/ -t "$HOME/bin" -R common serverscripts menuscripts mkdir -p "$HOME/.config" stow -d config/ -t "$HOME/.config" -R essentials common stow -d config/ -t "$HOME/" -R home -- cgit v1.2.3