diff options
author | Mario Forzanini <mf@marioforzanini.com> | 2024-08-04 21:06:50 +0200 |
---|---|---|
committer | Mario Forzanini <mf@marioforzanini.com> | 2024-08-04 21:06:50 +0200 |
commit | f273588d5ffc4651cd8e94d233372955a607feb9 (patch) | |
tree | 06ebb562bdc4119c07441d3a998393de5874b9ee | |
parent | 7c1ce8d2c9cd296022c3ef212dc03a2b30c2bebe (diff) |
-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 |