Adds the option to type a passord in password manager
This commit is contained in:
parent
4893824aff
commit
6f76248af8
2 changed files with 30 additions and 2 deletions
|
@ -3,6 +3,15 @@
|
|||
PASSWORDS="$HOME/.password-store"
|
||||
|
||||
|
||||
function type_password(){
|
||||
local password="$1"
|
||||
local pw=$(pass "$password" | head -n 1)
|
||||
if [ -z "$pw" ]; then
|
||||
exit 1
|
||||
fi
|
||||
sleep 1
|
||||
echo "$pw" | xdotool type --clearmodifiers --file -
|
||||
}
|
||||
function copy_password(){
|
||||
local password="$1"
|
||||
local part="${2:-0}"
|
||||
|
@ -40,7 +49,7 @@ if [ -d "$PASSWORDS" ]; then
|
|||
selection="$1"
|
||||
ret="${2:-0}"
|
||||
if [ -z "$selection" ]; then
|
||||
selection=$((find . -type f -name '*.gpg' | sed 's/.gpg$//' | sed 's/^.\///') | rofi -dmenu -kb-custom-1 "Ctrl-o" -i -l 20)
|
||||
selection=$((find . -type f -name '*.gpg' | sed 's/.gpg$//' | sed 's/^.\///') | rofi -dmenu -kb-custom-1 "Ctrl-o" -kb-custom-2 "Ctrl-i" -i -l 20)
|
||||
ret="$?"
|
||||
fi
|
||||
if [ -n "$selection" ]; then
|
||||
|
@ -52,7 +61,11 @@ if [ -d "$PASSWORDS" ]; then
|
|||
name="$(rofi -dmenu -p Name -lines 0)"
|
||||
# Todo - create new passwords
|
||||
else
|
||||
copy_password "$selection" "$ret"
|
||||
if [ "$ret" -ne "11" ]; then
|
||||
copy_password "$selection" "$ret"
|
||||
else
|
||||
type_password "$selection" "$ret"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
|
|
15
bin/.bin/dmenu/rofi-background
Executable file
15
bin/.bin/dmenu/rofi-background
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
case "$(echo -e "default\nfilm\nearth" | rofi -dmenu)" in
|
||||
default)
|
||||
feh --bg-fill "$HOME/Pictures/background"
|
||||
;;
|
||||
earth)
|
||||
background --notify --earth
|
||||
;;
|
||||
film)
|
||||
dir="$HOME/Videos/wallpaper-candidates/"
|
||||
background --film $( ls "$dir" | rofi -dmenu )
|
||||
;;
|
||||
esac
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue