diff options
-rw-r--r-- | sh/kp | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -0,0 +1,21 @@ +#!/bin/sh -e + +if [[ -n $WAYLAND_DISPLAY ]]; then + dmenu="wofi --dmenu" +elif [[ -n $DISPLAY ]]; then + dmenu=dmenu +else + echo "Error: No Wayland or X11 display detected" >&2 + exit 1 +fi + +db="$HOME/.local/share/Passwords.kdbx" +entry="$(pass keepass | keepassxc-cli ls $db | $dmenu)" + +if [ ! -z "$entry" ]; then + pass keepass | keepassxc-cli clip "$db" "$entry" & + pid=$! + sleep 0.5 + notify-send "KeepassXC" "Clipped $entry" + wait $pid && notify-send "KeepassXC" "Clipboard cleared" +fi |