config.phundrak.com/.local/bin/rofi-pass

36 lines
771 B
Plaintext
Raw Normal View History

#!/usr/bin/env fish
for arg in $argv
switch $arg
case '--type'
set -g TYPE "yes"
case '-t'
set -g TYPE "yes"
case 'type'
set -g TYPE "yes"
case '*'
printf 'Unknown argument: %s\n.' $arg
exit 1
end
end
set passwords (find $HOME/.password-store -type f -name "*.gpg" | \
string replace -r ".*.password-store/" "" | \
string replace -r ".gpg" "" | sort)
set password (for elem in $passwords
echo $elem
end | rofi -dmenu -i -p "Select your password")
if test -z $password
exit
end
if test $TYPE = "yes"
set -l IFS
set pass (pass show $password | string split -n \n)[1]
printf %s $pass | xvkbd -file -
else
pass show -c $password 2> /dev/null
end