From 171c1f519b902e1654e17bd33cb129569478f7f7 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 6 Aug 2023 14:57:37 +0200 Subject: don't create temp file --- bin/menuscripts/mhelp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'bin/menuscripts') diff --git a/bin/menuscripts/mhelp b/bin/menuscripts/mhelp index e03222b..5963a88 100755 --- a/bin/menuscripts/mhelp +++ b/bin/menuscripts/mhelp @@ -1,5 +1,4 @@ #!/usr/bin/env sh -OPTIONS="/tmp/dmh_options.txt" if [ "$MENUCMD" = "tofi" ] then @@ -16,18 +15,15 @@ fi test -z "$program" && exit 1 -if $program --help > "$OPTIONS" -then - option="$(grep "^ *-[-a-zA-Z0-9]* " "$OPTIONS" | - tr -s ' ' | - sort | - uniq | - column -l 2 -t | - $menucmd | - awk '{print $1}')" -fi +option="$($program --help | + # Parse options + grep "^ *-[-a-zA-Z0-9]* " | + tr -s ' ' | + sort | uniq | + column -l 2 -t | + $menucmd | + awk '{print $1}')" test -z "$option" && exit 1 -rm -f "$OPTIONS" setsid $program $option -- cgit v1.2.3 From ffb6d1aaedaa3882e356d7d58a5734b6f6a653e7 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Fri, 11 Aug 2023 18:21:47 +0200 Subject: [mpass] added notification --- bin/menuscripts/mpass | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'bin/menuscripts') diff --git a/bin/menuscripts/mpass b/bin/menuscripts/mpass index a50f0fb..8153dc6 100755 --- a/bin/menuscripts/mpass +++ b/bin/menuscripts/mpass @@ -20,6 +20,8 @@ done test -z "$file" && exit 1 pass show -c "$file" && if [ -n "$WAYLAND_DISPLAY" ] && cliphist list >/dev/null -then - cliphist list | head -n 1 | cliphist delete -fi + then + cliphist list | head -n 1 | cliphist delete + fi || + exit 1 +notify-send "mpass" "copied $choice" -- cgit v1.2.3 From f7e3dc17c1692c8099ca4b80814db49d9da2c74c Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 13 Aug 2023 02:01:02 +0200 Subject: [mpass] cleanup of messages and commands --- bin/guiscripts/keyadd | 20 ++++++++++---------- bin/menuscripts/mpass | 16 ++++++++-------- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'bin/menuscripts') diff --git a/bin/guiscripts/keyadd b/bin/guiscripts/keyadd index e0a1661..cb81efe 100755 --- a/bin/guiscripts/keyadd +++ b/bin/guiscripts/keyadd @@ -35,7 +35,7 @@ SSHFOLDER="$HOME/.ssh" ssh-add -l > /dev/null 2>&1 if [ $? -gt 1 ] # ignore if there are no identities then - notify "could not connect to agent." + notify "Could not connect to agent." exit 1 fi @@ -50,26 +50,26 @@ else fi die "key: $key" -test ! -f "$SSHFOLDER/$key" && exit 1 +[ ! -f "$SSHFOLDER/$key" ] && exit 1 -HOST=$(hostnamectl hostname | sed 's/forlure/fl/;s/montecristo/mc/') -die "HOST: $HOST" +HOST=$(hostnamectl hostname) +die "host: $HOST" if [ "$1" = "-d" ] then - if ssh-add -d - < "$SSHFOLDER"/"$key".pub + if ssh-add -q -d - < "$SSHFOLDER"/"$key".pub 2> /dev/null then - notify "deleted $key" + notify "Deleted $key" else - notify "could not delete." + notify "Could not delete." fi # check if key is already added elif ssh-add -l | grep -q "$(ssh-keygen -lf "$SSHFOLDER"/"$key")" then - notify "key already added." + notify "Key already added." else export PASSWORD="keys/$HOST/ssh/$key" export SSH_ASKPASS="$0" - ssh-add - < "$SSHFOLDER"/"$key" && - notify "added $key" + ssh-add -q - < "$SSHFOLDER"/"$key" && + notify "Added $key." fi diff --git a/bin/menuscripts/mpass b/bin/menuscripts/mpass index 8153dc6..0117b97 100755 --- a/bin/menuscripts/mpass +++ b/bin/menuscripts/mpass @@ -16,12 +16,12 @@ do [ "$choice" ] || break file="$file/$choice" done - test -z "$file" && exit 1 -pass show -c "$file" && - if [ -n "$WAYLAND_DISPLAY" ] && cliphist list >/dev/null - then - cliphist list | head -n 1 | cliphist delete - fi || - exit 1 -notify-send "mpass" "copied $choice" + +pass show -c "$file" +test $? -gt 0 && exit 1 + +[ "$WAYLAND_DISPLAY" ] && cliphist list >/dev/null && # on wayland and cliphist is running + cliphist list | head -n 1 | cliphist delete + +notify-send -t 1000 "mpass" "copied $choice" -- cgit v1.2.3 From ab67292b4ce728aea904799197e761002832f8c5 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 13 Aug 2023 20:37:39 +0200 Subject: [mpass] cleanup of error handling use || instead of test $? -gt 0, because they do the same thing. --- bin/menuscripts/mpass | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'bin/menuscripts') diff --git a/bin/menuscripts/mpass b/bin/menuscripts/mpass index 0117b97..4ecd4bc 100755 --- a/bin/menuscripts/mpass +++ b/bin/menuscripts/mpass @@ -18,10 +18,8 @@ do done test -z "$file" && exit 1 -pass show -c "$file" -test $? -gt 0 && exit 1 +pass show -c "$file" || exit 1 +notify-send -t 1000 "mpass" "copied $choice" [ "$WAYLAND_DISPLAY" ] && cliphist list >/dev/null && # on wayland and cliphist is running cliphist list | head -n 1 | cliphist delete - -notify-send -t 1000 "mpass" "copied $choice" -- cgit v1.2.3