Browse Source

Fix alternate password filtering

master
= 3 years ago
parent
commit
01d77c1903
1 changed files with 13 additions and 4 deletions
  1. +13
    -4
      prompt

+ 13
- 4
prompt View File

@@ -135,7 +135,7 @@ notify-send -u low -t 3000 "Download complete"
download_music() { download_music() {
youtube-dl --no-progress -f bestaudio -o \ youtube-dl --no-progress -f bestaudio -o \
"$HOME/downloads/music/%(track)s - %(artist)s.%(ext)s" "$(xclip -selection clipboard -o)" "$HOME/downloads/music/%(track)s - %(artist)s.%(ext)s" "$(xclip -selection clipboard -o)"
if [ $? ]; then
if [ ! $? ]; then
youtube-dl --no-progress -f bestaudio -o \ youtube-dl --no-progress -f bestaudio -o \
"$HOME/downloads/music/%(title)s - %(artist)s.%(ext)s" "$(xclip -selection clipboard -o)" "$HOME/downloads/music/%(title)s - %(artist)s.%(ext)s" "$(xclip -selection clipboard -o)"
fi fi
@@ -300,6 +300,7 @@ sel_account() {
dmenu -p 'account' dmenu -p 'account'
) )
if [ -z "$account" ]; then exit; fi if [ -z "$account" ]; then exit; fi
printf "$account"
} }


username() { username() {
@@ -322,14 +323,22 @@ password() {


} }


# Giving multiple accounts for the same service the same username may cause problems.
# It assumes that the password is always the first line of the account's section,
# and the username is always the second
other_password() { other_password() {
account=$(sel_account) account=$(sel_account)
name=$(pass show "$account" | sed -n -e "s/^username: //p" | name=$(pass show "$account" | sed -n -e "s/^username: //p" |
dmenu -p 'which user password')
dmenu -i -p 'which user password')
if [ -z "$name" ]; then exit; fi if [ -z "$name" ]; then exit; fi
pass show $account | sed "/^$/,/^username: $name/ { /^$/n }" | head -n1 | tr -d '\n' | xclip -selection clipboard
copy=$(pass show $account | grep -B 1 "^username: $name" | head -n1 | tr -d '\n')
printf "$copy" | xclip -selection clipboard
notify-send -u low -t 2000 "password copied" "$account: $name" notify-send -u low -t 2000 "password copied" "$account: $name"
sleep 30s
new_copy=$(xclip -o -selection clipboard)
if [ "$copy" = $newcopy ]; then
printf '' | xclip -selection clipboard
fi
} }


show_password() { show_password() {


Loading…
Cancel
Save