aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2022-10-03 17:17:14 +0800
committerHsieh Chin Fan <pham@topo.tw>2022-10-03 17:17:14 +0800
commit39ca5ff64c88d21ec4423ffa1f591f398814d698 (patch)
treee0d5a16e83774e10e8fa8f81cddf3151516ab767
parent596f8bf16ef20d04fb669f9db0cb5a69a3a4148e (diff)
Change paths
-rw-r--r--Makefile4
-rw-r--r--X11/openbox/rc.xml (renamed from misc/openbox/rc.xml)2
-rwxr-xr-xX11/rofi/pass.edit22
-rwxr-xr-xX11/rofi/pass.get54
-rwxr-xr-xX11/rofi/pass.rm21
-rwxr-xr-xX11/rofi/rofi-pass7
-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
diff --git a/Makefile b/Makefile
index aa594ea..a9ff0b2 100644
--- a/Makefile
+++ b/Makefile
@@ -76,10 +76,10 @@ blog:
76 fi 76 fi
77 77
78theme: 78theme:
79 ln -sf `pwd`/misc/themes ~/.themes 79 ln -sf `pwd`/X11/themes ~/.themes
80 80
81openbox: theme 81openbox: theme
82 ln -sf `pwd`/misc/openbox/rc.xml ~/.config/openbox/ 82 ln -sf `pwd`/X11/openbox/rc.xml ~/.config/openbox/
83 83
84archcraft: 84archcraft:
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
3ROFI_ARGS=( '-font' 'Hack 22' )
4ENTRIES="$(find ~/.password-store -name '*gpg' -printf %P\\n | sed 's/.gpg$//')"
5
6# Give rofi available passwords and exit
7if [ $# -eq 0 ]; then
8 # Specify rofi prompt as 'Edit'
9 echo -e "\0prompt\x1fEdit"
10
11 echo "$ENTRIES"
12 exit 0
13fi
14
15# If password doesn't exist, just quit
16<<<"$ENTRIES" grep -q $1 || exit 0
17
18# Use alacritty to edit password
19coproc (
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
3ROFI_ARGS=( '-font' 'Hack 22' )
4OPTIONS_NEW=( 'NO' 'YES' 'YES, and edit it' )
5
6# Generate a new password
7if [ -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
23fi
24
25# Give rofi available passwords and exit
26if [ $# -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
34fi
35
36# Test password exists or not
37RESULT="$(pass $1)"
38if [ -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
47else
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
54fi
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
3ROFI_ARGS=( '-font' 'Hack 22' )
4ENTRIES="$(find ~/.password-store -name '*gpg' -printf %P\\n | sed 's/.gpg$//')"
5
6# Give rofi available passwords and exit
7if [ $# -eq 0 ]; then
8 # Specify rofi prompt as 'Remove'
9 echo -e "\0prompt\x1fRemove"
10
11 echo "$ENTRIES"
12 exit 0
13fi
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
3cd $(dirname $0)
4
5rofi -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