#!/usr/bin/env sh store="${PASSWORD_STORE_DIR:-$HOME/.password-store}" lscmd="ls --group-directories-first" if [ "$MENUCMD" = "tofi" ] then menucmd="tofi --prompt pass:" elif [ "$MENUCMD" = "dmenu" ] then menucmd="dmenu -l 4 -g 2 -i -p pass:" else menucmd="fzf --prompt pass:" fi while [ -d "$store/$file" ] do choice="$($lscmd "$store/$file" | sed 's/\.gpg$//'| $menucmd)" [ "$choice" ] || break file="$file/$choice" done test -z "$file" && exit 1 pass show -c "$file" || exit 1 notify-send -t 1000 "mpass" "copied $choice" [ "$WAYLAND_DISPLAY" ] && cliphist list >/dev/null && # on wayland and cliphist is running cliphist list | head -n 1 | cliphist delete