diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | X11/openbox/rc.xml (renamed from misc/openbox/rc.xml) | 2 | ||||
-rwxr-xr-x | X11/rofi/pass.edit | 22 | ||||
-rwxr-xr-x | X11/rofi/pass.get | 54 | ||||
-rwxr-xr-x | X11/rofi/pass.rm | 21 | ||||
-rwxr-xr-x | X11/rofi/rofi-pass | 7 | ||||
-rw-r--r-- | X11/themes/Arc-Dark/openbox-3/themerc (renamed from misc/themes/Arc-Dark/openbox-3/themerc) | 0 |
7 files changed, 107 insertions, 3 deletions
@@ -76,10 +76,10 @@ blog: | |||
76 | fi | 76 | fi |
77 | 77 | ||
78 | theme: | 78 | theme: |
79 | ln -sf `pwd`/misc/themes ~/.themes | 79 | ln -sf `pwd`/X11/themes ~/.themes |
80 | 80 | ||
81 | openbox: theme | 81 | openbox: theme |
82 | ln -sf `pwd`/misc/openbox/rc.xml ~/.config/openbox/ | 82 | ln -sf `pwd`/X11/openbox/rc.xml ~/.config/openbox/ |
83 | 83 | ||
84 | archcraft: | 84 | archcraft: |
85 | ls -sf `pwd`/tools/desktop/takeshot /usr/local/bin/takeshot | 85 | ls -sf `pwd`/tools/desktop/takeshot /usr/local/bin/takeshot |
diff --git a/misc/openbox/rc.xml b/X11/openbox/rc.xml index ebf4fdb..c8b284a 100644 --- a/misc/openbox/rc.xml +++ b/X11/openbox/rc.xml | |||
@@ -576,7 +576,7 @@ | |||
576 | </keybind> | 576 | </keybind> |
577 | <keybind key="W-p"> | 577 | <keybind key="W-p"> |
578 | <action name="Execute"> | 578 | <action name="Execute"> |
579 | <command>~/bin/password-store.sh</command> | 579 | <command>~/helper/X11/rofi/rofi-pass</command> |
580 | </action> | 580 | </action> |
581 | </keybind> | 581 | </keybind> |
582 | <!-- CLI Apps --> | 582 | <!-- CLI Apps --> |
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 | ) | ||
diff --git a/X11/rofi/pass.get b/X11/rofi/pass.get new file mode 100755 index 0000000..df70652 --- /dev/null +++ b/X11/rofi/pass.get | |||
@@ -0,0 +1,54 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | ROFI_ARGS=( '-font' 'Hack 22' ) | ||
4 | OPTIONS_NEW=( 'NO' 'YES' 'YES, and edit it' ) | ||
5 | |||
6 | # Generate a new password | ||
7 | if [ -n "${ROFI_DATA}" ]; then | ||
8 | [ "$1" == "${OPTIONS_NEW[1]}" ] && \ | ||
9 | coproc ( | ||
10 | export POST=false | ||
11 | pass generate ${ROFI_DATA} --clip | ||
12 | rofi "${ROFI_ARGS[@]}" -e "Generate and Copied: ${ROFI_DATA}" | ||
13 | ) | ||
14 | |||
15 | [ "$1" == "${OPTIONS_NEW[2]}" ] && \ | ||
16 | coproc ( | ||
17 | export POST=false | ||
18 | pass generate ${ROFI_DATA} --clip | ||
19 | alacritty -e pass edit ${ROFI_DATA}; \ | ||
20 | ) | ||
21 | |||
22 | exit 0 | ||
23 | fi | ||
24 | |||
25 | # Give rofi available passwords and exit | ||
26 | if [ $# -eq 0 ]; then | ||
27 | # Specify rofi prompt as 'Get' | ||
28 | echo -e "\0prompt\x1fGet" | ||
29 | |||
30 | find ~/.password-store -name '*gpg' -printf %P\\n | \ | ||
31 | sed 's/.gpg$//' | ||
32 | |||
33 | exit 0 | ||
34 | fi | ||
35 | |||
36 | # Test password exists or not | ||
37 | RESULT="$(pass $1)" | ||
38 | if [ -n "$RESULT" ]; then | ||
39 | # Copy the given password into clipboard | ||
40 | echo "$RESULT" | head -1 | xsel -ib | ||
41 | |||
42 | # And show extra message | ||
43 | EXTRA="$(echo; echo; echo "$RESULT" | sed '1d; 1{/^$/d}')" | ||
44 | coproc ( rofi "${ROFI_ARGS[@]}" -e "Copied: $1$EXTRA" ) | ||
45 | # Password doesn't exist yet | ||
46 | # Go to next rofi execution | ||
47 | else | ||
48 | echo -e "\0prompt\x1f$1 doesn't exist, generate it?" | ||
49 | echo -e "\0data\x1f$1" | ||
50 | |||
51 | for i in "${OPTIONS_NEW[@]}"; do | ||
52 | echo $i | ||
53 | done | ||
54 | fi | ||
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 | ) | ||
diff --git a/X11/rofi/rofi-pass b/X11/rofi/rofi-pass new file mode 100755 index 0000000..1730b93 --- /dev/null +++ b/X11/rofi/rofi-pass | |||
@@ -0,0 +1,7 @@ | |||
1 | #! /bin/bash | ||
2 | |||
3 | cd $(dirname $0) | ||
4 | |||
5 | rofi -show get\ | ||
6 | -modes get:./pass.get,edit:./pass.edit,rm:./pass.rm \ | ||
7 | -font 'Hack 22' | ||
diff --git a/misc/themes/Arc-Dark/openbox-3/themerc b/X11/themes/Arc-Dark/openbox-3/themerc index 3db5fe5..3db5fe5 100644 --- a/misc/themes/Arc-Dark/openbox-3/themerc +++ b/X11/themes/Arc-Dark/openbox-3/themerc | |||