aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2022-10-03 20:36:48 +0800
committerHsieh Chin Fan <pham@topo.tw>2022-10-03 20:36:48 +0800
commit1d1174dc51c83fb247dbc62de3579bd48ac48427 (patch)
treea85fadefdaff8249e29617c671900f1d2288dfb5
parent39ca5ff64c88d21ec4423ffa1f591f398814d698 (diff)
Update
-rwxr-xr-xX11/rofi/pass.edit7
-rwxr-xr-xX11/rofi/pass.get9
-rwxr-xr-xX11/rofi/pass.rm5
-rwxr-xr-xX11/rofi/rofi-pass4
4 files changed, 10 insertions, 15 deletions
diff --git a/X11/rofi/pass.edit b/X11/rofi/pass.edit
index fb6ade9..428564d 100755
--- a/X11/rofi/pass.edit
+++ b/X11/rofi/pass.edit
@@ -1,6 +1,5 @@
1#! /bin/sh 1#! /bin/sh
2 2
3ROFI_ARGS=( '-font' 'Hack 22' )
4ENTRIES="$(find ~/.password-store -name '*gpg' -printf %P\\n | sed 's/.gpg$//')" 3ENTRIES="$(find ~/.password-store -name '*gpg' -printf %P\\n | sed 's/.gpg$//')"
5 4
6# Give rofi available passwords and exit 5# Give rofi available passwords and exit
@@ -15,8 +14,8 @@ fi
15# If password doesn't exist, just quit 14# If password doesn't exist, just quit
16<<<"$ENTRIES" grep -q $1 || exit 0 15<<<"$ENTRIES" grep -q $1 || exit 0
17 16
18# Use alacritty to edit password 17# Use detected terminal emulator to edit password
19coproc ( 18coproc (
20 alacritty -e pass edit $1 && pass $1 --clip 19 rofi-sensible-terminal -e pass edit $1 && pass $1 --clip
21 rofi "${ROFI_ARGS[@]}" -e "Copied: $1" 20 rofi -e "Copied: $1"
22) 21)
diff --git a/X11/rofi/pass.get b/X11/rofi/pass.get
index df70652..44857db 100755
--- a/X11/rofi/pass.get
+++ b/X11/rofi/pass.get
@@ -1,6 +1,5 @@
1#! /bin/sh 1#! /bin/sh
2 2
3ROFI_ARGS=( '-font' 'Hack 22' )
4OPTIONS_NEW=( 'NO' 'YES' 'YES, and edit it' ) 3OPTIONS_NEW=( 'NO' 'YES' 'YES, and edit it' )
5 4
6# Generate a new password 5# Generate a new password
@@ -9,14 +8,14 @@ if [ -n "${ROFI_DATA}" ]; then
9 coproc ( 8 coproc (
10 export POST=false 9 export POST=false
11 pass generate ${ROFI_DATA} --clip 10 pass generate ${ROFI_DATA} --clip
12 rofi "${ROFI_ARGS[@]}" -e "Generate and Copied: ${ROFI_DATA}" 11 rofi -e "Generate and Copied: ${ROFI_DATA}"
13 ) 12 )
14 13
15 [ "$1" == "${OPTIONS_NEW[2]}" ] && \ 14 [ "$1" == "${OPTIONS_NEW[2]}" ] && \
16 coproc ( 15 coproc (
17 export POST=false 16 export POST=false
18 pass generate ${ROFI_DATA} --clip 17 pass generate ${ROFI_DATA} --clip
19 alacritty -e pass edit ${ROFI_DATA}; \ 18 rofi-sensible-terminal -e pass edit ${ROFI_DATA}; \
20 ) 19 )
21 20
22 exit 0 21 exit 0
@@ -40,8 +39,8 @@ if [ -n "$RESULT" ]; then
40 echo "$RESULT" | head -1 | xsel -ib 39 echo "$RESULT" | head -1 | xsel -ib
41 40
42 # And show extra message 41 # And show extra message
43 EXTRA="$(echo; echo; echo "$RESULT" | sed '1d; 1{/^$/d}')" 42 EXTRA="$(echo; echo; echo "$RESULT" | sed '1d' | sed '1{/^$/d}')"
44 coproc ( rofi "${ROFI_ARGS[@]}" -e "Copied: $1$EXTRA" ) 43 coproc ( rofi -e "Copied: $1$EXTRA" )
45# Password doesn't exist yet 44# Password doesn't exist yet
46# Go to next rofi execution 45# Go to next rofi execution
47else 46else
diff --git a/X11/rofi/pass.rm b/X11/rofi/pass.rm
index 44bdc33..a407792 100755
--- a/X11/rofi/pass.rm
+++ b/X11/rofi/pass.rm
@@ -1,6 +1,5 @@
1#! /bin/sh 1#! /bin/sh
2 2
3ROFI_ARGS=( '-font' 'Hack 22' )
4ENTRIES="$(find ~/.password-store -name '*gpg' -printf %P\\n | sed 's/.gpg$//')" 3ENTRIES="$(find ~/.password-store -name '*gpg' -printf %P\\n | sed 's/.gpg$//')"
5 4
6# Give rofi available passwords and exit 5# Give rofi available passwords and exit
@@ -16,6 +15,6 @@ fi
16<<<"$ENTRIES" grep -q $1 && \ 15<<<"$ENTRIES" grep -q $1 && \
17 coproc ( 16 coproc (
18 pass rm $1 &>/dev/null && \ 17 pass rm $1 &>/dev/null && \
19 rofi "${ROFI_ARGS[@]}" -e "Removed: $1" || \ 18 rofi -e "Removed: $1" || \
20 rofi "${ROFI_ARGS[@]}" -e "Fail to remove $1" 19 rofi -e "Fail to remove $1"
21 ) 20 )
diff --git a/X11/rofi/rofi-pass b/X11/rofi/rofi-pass
index 1730b93..b6a1e01 100755
--- a/X11/rofi/rofi-pass
+++ b/X11/rofi/rofi-pass
@@ -2,6 +2,4 @@
2 2
3cd $(dirname $0) 3cd $(dirname $0)
4 4
5rofi -show get\ 5rofi -show get -modes get:./pass.get,edit:./pass.edit,rm:./pass.rm
6 -modes get:./pass.get,edit:./pass.edit,rm:./pass.rm \
7 -font 'Hack 22'