Skip to content

Instantly share code, notes, and snippets.

@elumbella
Created January 20, 2021 10:16
Show Gist options
  • Save elumbella/c329f088a2eddd8ea115d5a61a0dda4c to your computer and use it in GitHub Desktop.
Save elumbella/c329f088a2eddd8ea115d5a61a0dda4c to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Very basic interface for pass using wofi
# Get all password files and create an array
root=~/.password-store
CACHE=~/.local/tmp/pass_wofi
list_passwords() {
shopt -s nullglob globstar
cd "${root}" || exit
pw_list=(**/*.gpg)
printf '%s\n' "${pw_list[@]%.gpg}" | sort -n
}
prompt='search for passwords...'
SECRET=$(list_passwords | wofi -i --width 700 --lines 20 --height 250 --prompt="${prompt}" --dmenu --cache-file ${CACHE})
# Get password
PASSWD_PASS=$(pass ${SECRET})
# Strip extra lines
PASSWD_PASS=(${PASSWD_PASS[@]})
wl-copy -o ${PASSWD_PASS}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment