From 72a766220b5305187255448c168c282b37512aba Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Thu, 22 Jun 2023 13:30:43 +0200 Subject: use pass variable --- bin/menuscripts/mpass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/menuscripts/mpass b/bin/menuscripts/mpass index 01c40e3..87559e9 100755 --- a/bin/menuscripts/mpass +++ b/bin/menuscripts/mpass @@ -1,5 +1,5 @@ #!/usr/bin/env sh -store="$HOME/.password-store" +store="${PASSWORD_STORE_DIR:-$HOME/.password-store}" lscmd="ls --group-directories-first" if [ "$MENUCMD" = "tofi" ] then -- cgit v1.2.3 From ab76fc99422a9147f745c48e301dbbb1cd5db29d Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Thu, 22 Jun 2023 13:35:14 +0200 Subject: use variable for tmpfile --- bin/menuscripts/mvid | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/menuscripts/mvid b/bin/menuscripts/mvid index 8d14c4b..ca309fb 100755 --- a/bin/menuscripts/mvid +++ b/bin/menuscripts/mvid @@ -1,10 +1,11 @@ #!/usr/bin/env sh +tmpfile="/tmp/dmvids" + dirs="${1:-$HOME/vids $HOME/dl}" find -L $dirs 2> /dev/null | grep ".\+\.\(webm\|mp4\|mpeg\|mkv\)$" | - sort > /tmp/dmvids -cat /tmp/dmvids + sort > "$tmpfile" if [ "$MENUCMD" = "tofi" ] then @@ -16,11 +17,11 @@ else menucmd="fzf" fi -choice="$(sed 's|^/home/aluc|\~| ; s|\([^/]\)[^/]*/|\1/|g' /tmp/dmvids | +choice="$(sed "s|^$HOME|\~| ; s|\([^/]\)[^/]*/|\1/|g" "$tmpfile" | awk '{printf "%s %s\n", NR ":", $0}' | $menucmd | cut -f 1 -d ':')" test -z "$choice" && exit 1 -mpv "$(sed -n "${choice}p" /tmp/dmvids)" +mpv "$(sed -n "${choice}p" "$tmpfile")" -- cgit v1.2.3 From 52b3327fb2e63c5756198e7f183e5f610f1f3934 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Thu, 22 Jun 2023 13:35:30 +0200 Subject: small refactor --- bin/menuscripts/mpdf | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'bin') diff --git a/bin/menuscripts/mpdf b/bin/menuscripts/mpdf index d26c841..d67fdae 100755 --- a/bin/menuscripts/mpdf +++ b/bin/menuscripts/mpdf @@ -12,14 +12,11 @@ fi tmp="/tmp/dmpdf" find ${1:-$HOME/docs $HOME/dl} 2> /dev/null | grep -E ".+\.pdf" | sort > "$tmp" -choice="$(\ - sed 's|^/home/aluc|\~| ; s|\([^/]\)[^/]*/|\1/|g' "$tmp" | +choice="$(sed "s|^$HOME|\~| ; s|\([^/]\)[^/]*/|\1/|g" "$tmp" | awk '{printf "%s %s\n", NR ":", $0}' | $menucmd | - grep -oE "^[0-9]+:" | - cut -f1 -d:)" -if [ -z "$choice" ]; then - exit -fi + grep -o "^[0-9]\+:" | + cut -f 1 -d :)" +test -z "$choice" && exit 1 file="$(sed -n "${choice}p" "$tmp")" zathura "$file" & -- cgit v1.2.3