diff options
-rwxr-xr-x | passmenu.sh | 43 | ||||
-rwxr-xr-x | weather.sh | 2 |
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" @@ -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 |