diff options
Diffstat (limited to 'X11/rofi/pass.rm')
-rwxr-xr-x | X11/rofi/pass.rm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/X11/rofi/pass.rm b/X11/rofi/pass.rm new file mode 100755 index 0000000..44bdc33 --- /dev/null +++ b/X11/rofi/pass.rm | |||
@@ -0,0 +1,21 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | ROFI_ARGS=( '-font' 'Hack 22' ) | ||
4 | ENTRIES="$(find ~/.password-store -name '*gpg' -printf %P\\n | sed 's/.gpg$//')" | ||
5 | |||
6 | # Give rofi available passwords and exit | ||
7 | if [ $# -eq 0 ]; then | ||
8 | # Specify rofi prompt as 'Remove' | ||
9 | echo -e "\0prompt\x1fRemove" | ||
10 | |||
11 | echo "$ENTRIES" | ||
12 | exit 0 | ||
13 | fi | ||
14 | |||
15 | # If password doesn't exist, just quit | ||
16 | <<<"$ENTRIES" grep -q $1 && \ | ||
17 | coproc ( | ||
18 | pass rm $1 &>/dev/null && \ | ||
19 | rofi "${ROFI_ARGS[@]}" -e "Removed: $1" || \ | ||
20 | rofi "${ROFI_ARGS[@]}" -e "Fail to remove $1" | ||
21 | ) | ||