aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2022-09-27 23:00:18 +0800
committerHsieh Chin Fan <pham@topo.tw>2022-09-27 23:00:18 +0800
commit74d99560d8a0dfcbf066668bce26d44a93b87ba9 (patch)
treec4338bd366e1dda39ef4fa3a04fc3806c8a45c71
parent32d48e1c1578b6498e7bcb4476b02a5f937a4fd5 (diff)
Add script for password with rofi
-rw-r--r--misc/openbox/rc.xml15
-rwxr-xr-xtools/desktop/password-store.sh19
2 files changed, 21 insertions, 13 deletions
diff --git a/misc/openbox/rc.xml b/misc/openbox/rc.xml
index 9874de1..bd1baa6 100644
--- a/misc/openbox/rc.xml
+++ b/misc/openbox/rc.xml
@@ -583,18 +583,7 @@
583 </keybind> 583 </keybind>
584 <keybind key="W-p"> 584 <keybind key="W-p">
585 <action name="Execute"> 585 <action name="Execute">
586 <command> 586 <command>~/helper/tools/desktop/password-store.sh</command>
587 alacritty --hold -e bash -c '
588 echo Use find or grep to search password
589 echo
590 while read -e target extra; do
591 if [[ "$target" == "" || "$target" == "find" || "$target" == "grep" ]]; then
592 pass $target $extra >/dev/tty
593 else
594 pass $target $extra &amp;&amp; break;
595 fi
596 done | tee >(echo; sed 1d >/dev/tty) | head -1 | xsel -ib'
597 </command>
598 </action> 587 </action>
599 </keybind> 588 </keybind>
600 <!-- CLI Apps --> 589 <!-- CLI Apps -->
@@ -622,7 +611,7 @@
622 </keybind> 611 </keybind>
623 <keybind key="C-A-h"> 612 <keybind key="C-A-h">
624 <action name="Execute"> 613 <action name="Execute">
625 <command>alacritty --title htop -e htop</command> 614 <command>alacritty --title htop -o "window.startup_mode=Maximized" -e htop</command>
626 </action> 615 </action>
627 </keybind> 616 </keybind>
628 <keybind key="C-A-b"> 617 <keybind key="C-A-b">
diff --git a/tools/desktop/password-store.sh b/tools/desktop/password-store.sh
new file mode 100755
index 0000000..e83529b
--- /dev/null
+++ b/tools/desktop/password-store.sh
@@ -0,0 +1,19 @@
1#! /bin/bash
2
3find ~/.password-store -name '*gpg' -printf %P\\n | \
4sed 's/.gpg$//' | \
5rofi -dmenu -font 'Hack 22' | {
6 read ARG1 ARG2
7 if [[ $ARG1 =~ gen ]]; then
8 # Generate a new password by ARG2
9 alacritty --hold -e pass generate $ARG2
10 else
11 pass $ARG1 | {
12 read PASSWORD
13 echo $PASSWORD | xsel -ib
14
15 rofi -e "Password Copied: $ARG1 $(echo; echo; cat | sed '1{/^$/d}')" \
16 -font 'Hack 22'
17 }
18 fi
19}