diff options
Diffstat (limited to 'X11/rofi/pass.edit')
-rwxr-xr-x | X11/rofi/pass.edit | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/X11/rofi/pass.edit b/X11/rofi/pass.edit new file mode 100755 index 0000000..fb6ade9 --- /dev/null +++ b/X11/rofi/pass.edit | |||
@@ -0,0 +1,22 @@ | |||
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 'Edit' | ||
9 | echo -e "\0prompt\x1fEdit" | ||
10 | |||
11 | echo "$ENTRIES" | ||
12 | exit 0 | ||
13 | fi | ||
14 | |||
15 | # If password doesn't exist, just quit | ||
16 | <<<"$ENTRIES" grep -q $1 || exit 0 | ||
17 | |||
18 | # Use alacritty to edit password | ||
19 | coproc ( | ||
20 | alacritty -e pass edit $1 && pass $1 --clip | ||
21 | rofi "${ROFI_ARGS[@]}" -e "Copied: $1" | ||
22 | ) | ||