Adds the option to type a passord in password manager

master
Jonathan Hodgson 5 years ago
parent 715b2b7d3e
commit 85af6ac011
  1. 15
      bin/.bin/dmenu/password-manager
  2. 15
      bin/.bin/dmenu/rofi-background

@ -3,6 +3,15 @@
PASSWORDS="$HOME/.password-store" 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(){ function copy_password(){
local password="$1" local password="$1"
local part="${2:-0}" local part="${2:-0}"
@ -40,7 +49,7 @@ if [ -d "$PASSWORDS" ]; then
selection="$1" selection="$1"
ret="${2:-0}" ret="${2:-0}"
if [ -z "$selection" ]; then 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="$?" ret="$?"
fi fi
if [ -n "$selection" ]; then if [ -n "$selection" ]; then
@ -52,7 +61,11 @@ if [ -d "$PASSWORDS" ]; then
name="$(rofi -dmenu -p Name -lines 0)" name="$(rofi -dmenu -p Name -lines 0)"
# Todo - create new passwords # Todo - create new passwords
else else
if [ "$ret" -ne "11" ]; then
copy_password "$selection" "$ret" copy_password "$selection" "$ret"
else
type_password "$selection" "$ret"
fi
fi fi
fi fi
else else

@ -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…
Cancel
Save