diff options
author | johannst <johannes.stoelp@gmail.com> | 2020-05-19 22:02:41 +0200 |
---|---|---|
committer | johannst <johannes.stoelp@gmail.com> | 2020-05-19 22:02:41 +0200 |
commit | a0089cb4a117930f3b9c36bcbbd6be8cf3747ff8 (patch) | |
tree | 3b7d4588a99f569a4994b46e8c49550d3da0325f /scripts/rofi_pass.sh | |
parent | 1c2275c86563a103a53a3199d25808aa98ed62dd (diff) | |
download | dotfiles-a0089cb4a117930f3b9c36bcbbd6be8cf3747ff8.tar.gz dotfiles-a0089cb4a117930f3b9c36bcbbd6be8cf3747ff8.zip |
added rofi config + installer
Diffstat (limited to 'scripts/rofi_pass.sh')
-rwxr-xr-x | scripts/rofi_pass.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/rofi_pass.sh b/scripts/rofi_pass.sh new file mode 100755 index 0000000..5382670 --- /dev/null +++ b/scripts/rofi_pass.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# dotfiles -- scripts/rofi_pass.sh +# author: johannst +# +# run as: rofi -show pass -modi pass:./rofi_pass.sh +# +# rofi will invoke this script without args to populate the selection dialogue. +# After selecting one element, rofi will invoke this script with the selection +# as argument. + +prefix=${PASSWORD_STORE_DIR:-~/.password-store} + +echo "1: $1" >> ~/ROFI + +password=$1 +if [ -z $password ]; then + shopt -s nullglob globstar + passwords=($prefix/**/*.gpg) + passwords=(${passwords[@]#$prefix/}) + passwords=(${passwords[@]%.gpg} ) + printf '%s\n' ${passwords[@]} +else + # Run async with coproc (rofi intrinsic) + # else rofi UI blocks pinentry. + coproc (pass show -c $password &> /dev/null) +fi |