Christoph's last Weblog entries

pass xdotool dmenu
27th June 2014

I've written a small dmenu-based script which allows to select passwords from one's pass password manager and have it xdotool typed in. This should completely bypass the clipboard (which is distrusted by people for a reason). As I've been asked about the script a few times in the past here it is. Feel free to copy and any suggestions welcome.

#!/bin/bash

list_passwords() {
	basedir=~/.password-store/
	passwords=( ~/.password-store/**/*.gpg ~/.password-store/*.gpg )
	for password in "${passwords[@]}"
	do
		filename="${password#$basedir}"
		filename="${filename%.gpg}"
		echo $filename
	done
}

xdotool_command() {
	echo -n "type "
	pass "$1"
}

selected_password="$(list_passwords 2>/dev/null| dmenu)"
if [ -n "$selected_password" ]
then
	xdotool_command "$selected_password" | xdotool -
fi
Tags: foss.

Created by Chronicle v4.6