diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2022-10-03 17:17:14 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2022-10-03 17:17:14 +0800 |
commit | 39ca5ff64c88d21ec4423ffa1f591f398814d698 (patch) | |
tree | e0d5a16e83774e10e8fa8f81cddf3151516ab767 /X11/rofi/pass.rm | |
parent | 596f8bf16ef20d04fb669f9db0cb5a69a3a4148e (diff) |
Change paths
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 | ) | ||