add wpass

This commit is contained in:
lelgenio 2020-04-14 14:51:53 -03:00
parent 6745ad71f9
commit 1d63d40df1
2 changed files with 55 additions and 4 deletions

50
scripts/.local/bin/wpass Executable file
View File

@ -0,0 +1,50 @@
#!/bin/bash
CACHE=~/.cache/wass-hist
set -e
shopt -s nullglob globstar
typeit=0
if [ "$1" = "--type" ]; then
typeit=1
shift
fi
prefix=${PASSWORD_STORE_DIR-~/.password-store}
password_files=( "$prefix"/**/*.gpg )
password_files=( "${password_files[@]#"$prefix"/}" )
password_files=( "${password_files[@]%.gpg}" )
[ -f $CACHE ] || touch $CACHE
for line in $(cat $CACHE); do
for password_file in "${password_files[@]}"; do
echo "$line" = "$password_file"
if [ "$line" = "$password_file" ];then
echo added
password_files+=( $line )
fi
done
done
entry=$(printf '%s\n' "${password_files[@]}" |
sort | uniq -c | sort -r | sed 's/ *[0-9]* //'|
bmenu "$@")
[ -n "$entry" ] && echo "$entry" >> $CACHE || exit
username=$( pass show "$entry" 2>/dev/null | perl -ne 'print $1 if /^login: (.*)/' )
password=$( pass show "$entry" 2>/dev/null | head -n 1 )
# | grep 'username'&&
case $(echo -e "Autotype\nUsername -> $username\nPassword" | bmenu) in
Autotype)
ydotool type "$username"
ydotool key tab
ydotool type "$password"
;;
Username*)
printf '%s' "$username" | wl-copy;;
Password)
printf '%s' "$password" | wl-copy;;
esac

View File

@ -16,7 +16,7 @@
set $up k
set $right l
set $term kitty
set $term alacritty
set $menu wofi --show drun --allow-images --insensitive -p'Iniciar: '
# set $menu bmenu run $term
# set $menu j4-dmenu-desktop --dmenu 'bmenu -p Iniciar:' --term $term
@ -47,6 +47,7 @@
#hide the mouse after 10 seconds
seat * hide_cursor 10000
seat * xcursor_theme capitaine-cursors
input "type:touchpad" {
#disable while typing
@ -80,7 +81,7 @@
bindsym $mod+d exec $menu
# Fill passwords
bindsym Control+$mod+p exec keepmenu
bindsym Control+$mod+p exec wpass
# mouse button for dragging.
floating_modifier $mod normal
@ -267,8 +268,8 @@
default_border pixel 2px
gaps inner 5px
smart_gaps on
smart_borders on
# smart_gaps on
# smart_borders on
# for_window [app_id=mpv] floating enable
for_window [app_id=weather] floating enable