Created
September 16, 2018 09:31
-
-
Save rtgnx/d47d1d295f208efe0a86281a9976a169 to your computer and use it in GitHub Desktop.
Select password from password store with rofi. Fills clipboard with garbage after 30s
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
[ ! -f "$(command -v rofi)" ] && echo "rofi not found" && exit 1 | |
[ ! -f "$(command -v pass)" ] && echo "pass not found" && exit 1 | |
PASWORD_STORE="$HOME/.password-store" | |
garbage() { | |
# Use only for throwing garbage into clipboard !!!! | |
tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 32 | head -n 1 | |
} | |
list() { | |
find "$PASWORD_STORE" -type f | sed -e "s|$PASWORD_STORE/||g" | sed 's/.gpg//g' | |
} | |
NAME="$(list | rofi -dmenu)" | |
[ ! -f "$PASWORD_STORE/$NAME.gpg" ] && echo "File does not exists" && exit 1 | |
pass "$NAME" | xclip -selection c | |
# Put some garbage into clipboard after 30s | |
sleep 30 && garbage | xclip -selection c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment