From d22b27180eb394f9443860ccdf2656d2fdef56ed Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 6 Aug 2023 14:57:14 +0200 Subject: updated notify-send command --- bin/guiscripts/keyadd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'bin/guiscripts') diff --git a/bin/guiscripts/keyadd b/bin/guiscripts/keyadd index 96d6d03..1df8896 100755 --- a/bin/guiscripts/keyadd +++ b/bin/guiscripts/keyadd @@ -43,16 +43,16 @@ die "HOST: $HOST" if [ "$1" = "-d" ] then ssh-add -d - < "$SSHFOLDER"/$key.pub && - notify-send "$0" "deleted $key" || - notify-send "$0" "could not delete." + notify-send "keyadd" "deleted $key" || + notify-send "keyadd" "could not delete." elif ! ssh-add -l | grep -q "$(ssh-keygen -lf "$SSHFOLDER"/$key)" then die "adding: $key" export PASSWORD="keys/$HOST/ssh/$key" export SSH_ASKPASS="$0" ssh-add - < "$SSHFOLDER"/$key && - notify-send "$0" "added $key" + notify-send "keyadd" "added $key" else die "key already added." - notify-send "$0" "key already added." + notify-send "keyadd" "key already added." fi -- cgit v1.2.3 From 8a2272e0f5f4b43f7ba3fa11f5887880299573b3 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 13 Aug 2023 01:53:23 +0200 Subject: [mpass] added notify function --- bin/guiscripts/keyadd | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'bin/guiscripts') diff --git a/bin/guiscripts/keyadd b/bin/guiscripts/keyadd index 1df8896..4613b8f 100755 --- a/bin/guiscripts/keyadd +++ b/bin/guiscripts/keyadd @@ -22,6 +22,13 @@ die () echo "$1" >&2 } +notify () +{ + notify-send -t 1000 "keyadd" "$1" + die "$1" +} + + SSHFOLDER="$HOME/.ssh" if test -z "${key:=$1}" @@ -42,17 +49,19 @@ die "HOST: $HOST" if [ "$1" = "-d" ] then - ssh-add -d - < "$SSHFOLDER"/$key.pub && - notify-send "keyadd" "deleted $key" || - notify-send "keyadd" "could not delete." -elif ! ssh-add -l | grep -q "$(ssh-keygen -lf "$SSHFOLDER"/$key)" + if ssh-add -d - < "$SSHFOLDER"/"$key".pub + then + notify "deleted $key" + else + notify "could not delete." + fi +# check if key is already added +elif ssh-add -l | grep -q "$(ssh-keygen -lf "$SSHFOLDER"/"$key")" then - die "adding: $key" + notify "key already added." +else export PASSWORD="keys/$HOST/ssh/$key" export SSH_ASKPASS="$0" - ssh-add - < "$SSHFOLDER"/$key && - notify-send "keyadd" "added $key" -else - die "key already added." - notify-send "keyadd" "key already added." + ssh-add - < "$SSHFOLDER"/"$key" && + notify "added $key" fi -- cgit v1.2.3 From 396e509716ae5b334f4d588a9b425476770577ea Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 13 Aug 2023 01:57:30 +0200 Subject: [mpass] added test for connecting to agent --- bin/guiscripts/keyadd | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'bin/guiscripts') diff --git a/bin/guiscripts/keyadd b/bin/guiscripts/keyadd index 4613b8f..e0a1661 100755 --- a/bin/guiscripts/keyadd +++ b/bin/guiscripts/keyadd @@ -31,7 +31,15 @@ notify () SSHFOLDER="$HOME/.ssh" -if test -z "${key:=$1}" +# Test if can connect to ssh-agent +ssh-add -l > /dev/null 2>&1 +if [ $? -gt 1 ] # ignore if there are no identities +then + notify "could not connect to agent." + exit 1 +fi + +if [ -z "${key:=$1}" ] then key="$(find "$SSHFOLDER" -iname "*.pub" | sed "s,$SSHFOLDER/,," | # Clean -- 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/guiscripts') 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 949d2f7025cbfe4db316a3fc13199ac5c82d4b5b Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 13 Aug 2023 20:18:46 +0200 Subject: [zshrc] use exec and keychain identity Add keychain identity on startup, this is more useful because with suspend I will only type the password once per day. Also it makes adding with keyadd faster. Also use exec to have less processes, don't know if it works though... --- bin/guiscripts/startw | 1 + config/essentials/zsh/.zshrc | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'bin/guiscripts') diff --git a/bin/guiscripts/startw b/bin/guiscripts/startw index 768f401..9b35556 100755 --- a/bin/guiscripts/startw +++ b/bin/guiscripts/startw @@ -1,5 +1,6 @@ #!/bin/sh eval "$(keychain --dir "$XDG_CONFIG_HOME/keychain" --eval --quiet --agents gpg,ssh)" +eval "$(keychain --dir "$XDG_CONFIG_HOME/keychain" --eval --quiet --agents gpg 3A626DD20A32EB2E5DD9CE71CFD9ABC97158CD5D 2> /dev/null)" Hyprland diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index d8675d4..0665533 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -5,9 +5,9 @@ then clear if [ "/dev/tty1" = "$TTY" ] then - startw > /dev/null 2>&1 + exec startw > /dev/null 2>&1 else - startx > /dev/null 2>&1 + exec startx > /dev/null 2>&1 fi exit fi -- cgit v1.2.3