From ebfbeb7c5c92edb0c1d39450928b6227679327e5 Mon Sep 17 00:00:00 2001 From: 53hornet Date: Mon, 6 Dec 2021 21:01:50 -0500 Subject: feat: add passmenu w/ rofi, right click weather block opens windy --- passmenu.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ weather.sh | 2 ++ 2 files changed, 45 insertions(+) create mode 100755 passmenu.sh 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 -- cgit v1.2.3