Lots of bin changes
This commit is contained in:
parent
2c617a5b49
commit
121798e075
12 changed files with 258 additions and 44 deletions
|
@ -5,15 +5,27 @@ PASSWORDS="$HOME/.password-store"
|
|||
|
||||
function copy_password(){
|
||||
local password="$1"
|
||||
local part="${2:-0}"
|
||||
local sleep_argv0="jh password store sleep on display $DISPLAY"
|
||||
local before="$(xclip -o -selection clipboard 2>/dev/null | base64)"
|
||||
pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
|
||||
local pw=$(pass "$selection" | head -n 1)
|
||||
local pw=""
|
||||
case "$part" in
|
||||
"10"|"otp")
|
||||
local pw=$(pass otp "$password" | head -n 1)
|
||||
;;
|
||||
*)
|
||||
local pw=$(pass "$password" | head -n 1)
|
||||
;;
|
||||
esac
|
||||
if [ -z "$pw" ]; then
|
||||
exit 1
|
||||
fi
|
||||
echo "$pw" | xclip -selection "primary"
|
||||
echo "$pw" | xclip -selection "clipboard"
|
||||
notify-send "Password put on clipboard" "Will be removed in 10 seconds"
|
||||
notify-send -t 3000 "Password put on clipboard" "Will be removed in 3 seconds"
|
||||
(
|
||||
( exec -a "$sleep_argv0" bash <<<"trap 'kill %1' TERM; sleep '10' & wait" )
|
||||
( exec -a "$sleep_argv0" bash <<<"trap 'kill %1' TERM; sleep '3' & wait" )
|
||||
|
||||
echo "$before" | base64 -d | xclip -selection "primary"
|
||||
echo "$before" | base64 -d | xclip -selection "clipboard"
|
||||
|
@ -25,7 +37,12 @@ function copy_password(){
|
|||
|
||||
if [ -d "$PASSWORDS" ]; then
|
||||
cd "$PASSWORDS"
|
||||
selection=$((echo "NEW";find . -type f -name '*.gpg' | sed 's/.gpg$//' | sed 's/^.\///') | rofi -dmenu -i -l 20)
|
||||
selection="$1"
|
||||
ret="${2:-0}"
|
||||
if [ -z "$selection" ]; then
|
||||
selection=$((find . -type f -name '*.gpg' | sed 's/.gpg$//' | sed 's/^.\///') | rofi -dmenu -kb-custom-1 "Ctrl-o" -i -l 20)
|
||||
ret="$?"
|
||||
fi
|
||||
if [ -n "$selection" ]; then
|
||||
if [[ "$selection" == "NEW" ]]; then
|
||||
dir="$(find . -type d -not -path \*.git\* |rofi -dmenu -p Directory | sed 's/^.\/?//')"
|
||||
|
@ -35,9 +52,9 @@ if [ -d "$PASSWORDS" ]; then
|
|||
name="$(rofi -dmenu -p Name -lines 0)"
|
||||
# Todo - create new passwords
|
||||
else
|
||||
copy_password "$selection"
|
||||
copy_password "$selection" "$ret"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
notify-send "$BOOKMARKS doesn't exist"
|
||||
notify-send "\$PASSWORDS doesn't exist"
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue