Skip to content

Instantly share code, notes, and snippets.

@igemnace
Last active December 20, 2023 21:32
Show Gist options
  • Save igemnace/2b8609d280752e8a1b173204c14f6892 to your computer and use it in GitHub Desktop.
Save igemnace/2b8609d280752e8a1b173204c14f6892 to your computer and use it in GitHub Desktop.
Rofi script to find a password from password-store and copy it to clipboard.
#!/usr/bin/env bash
cd "$HOME/.password-store" || exit 1
pass_name=$(fd --type file --exec echo '{.}' | rofi -dmenu -i -p "pass")
[[ -n $pass_name ]] || exit 1
if pass show -c "$pass_name"; then
notify-send --urgency=normal "$pass_name" "Password copied to clipboard!"
fi
@alenpaulvarghese
Copy link

Sorting the passwords alphabetically would be nice.

pass_name=$(cd $HOME/.password-store && rg --files | sort |sed 's/\.gpg$//' | rofi -dmenu -i -p "pass:")

BTW thanks for this amazing scripts :)

@igemnace
Copy link
Author

Ah! Pleasant surprise to see someone else using this. The first version had bad shell practices -- I've updated it to the current version I use. Hopefully less bad bash to go around on the web.

Uses https://github.com/sharkdp/fd (and notify-send from libnotify) but doesn't necessarily need it -- feel free to replace with find. But fd is nice -- let this be a shout-out to the lucky 10 thousand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment