summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author53hornet <atc@53hor.net>2021-12-06 21:01:50 -0500
committer53hornet <atc@53hor.net>2021-12-06 21:01:50 -0500
commitebfbeb7c5c92edb0c1d39450928b6227679327e5 (patch)
treeecf9cca2fcf5d52453f0fc539fdee47c4bf66355
parent88784a46b3f0faf3c85010cbc3e2fe3c26939879 (diff)
downloadscripts-ebfbeb7c5c92edb0c1d39450928b6227679327e5.tar.xz
scripts-ebfbeb7c5c92edb0c1d39450928b6227679327e5.zip
feat: add passmenu w/ rofi, right click weather block opens windy
-rwxr-xr-xpassmenu.sh43
-rwxr-xr-xweather.sh2
2 files changed, 45 insertions, 0 deletions
diff --git a/passmenu.sh b/passmenu.sh
new file mode 100755
index 0000000..a7bd8cb
--- /dev/null
+++ b/passmenu.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+prefix=${PASSWORD_STORE_DIR:-~/.password-store}
+
+get_password() {
+ dmenu -i -p pass
+}
+
+get_passwords() {
+ find -s "$prefix" -type f -name '*.gpg'
+}
+
+trim_prefix() {
+ while read line
+ do
+ printf '%s\n' "${line##$prefix/}"
+ done
+}
+
+trim_suffix() {
+ while read line
+ do
+ printf '%s\n' "${line%%.gpg}"
+ done
+}
+
+copy_pass() {
+ [ -n "$1" ] || return
+
+ otp=''
+
+ case "$1" in
+ totp*)
+ otp=otp
+ ;;
+ esac
+
+ pass $otp show --clip "$1" 2>/dev/null
+}
+
+password=$(get_passwords | trim_prefix | trim_suffix | get_password)
+[ -n "$password" ] || exit 0
+msg=$(copy_pass "$password")
+notify-send passmenu "$msg"
diff --git a/weather.sh b/weather.sh
index cb6a0ca..6bd0791 100755
--- a/weather.sh
+++ b/weather.sh
@@ -1,5 +1,7 @@
#!/bin/sh
+[ "$BLOCK_BUTTON" = 3 ] && $BROWSER 'https://www.windy.com/36.865/-76.468?36.362,-76.468,8'
+
API_KEY="$(cat ~/.config/openweathermap)"
ZIP_CODE=23435