Clear copied password from clipboard history

Programs:

Below is a modification of the fzf-pass script. It uses jq to remove the password from the clipboard history after 10 seconds.

#!/usr/bin/env bash

# modified version of: https://git.zx2c4.com/password-store/tree/contrib/dmenu/passmenu

histfile=~/.local/share/clipman.json

shopt -s nullglob globstar

typeit=0
if [[ $1 == "--type" ]]; then
    typeit=1
    shift
fi

prefix=${PASSWORD_STORE_DIR-~/.password-store}
password_files=("$prefix"/**/*.gpg)
password_files=("${password_files[@]#"$prefix"/}")
password_files=("${password_files[@]%.gpg}")

password=$(printf '%s\n' "${password_files[@]}" | rofi -dmenu -p gopass "$@")

[[ -n $password ]] || exit


if [[ $typeit -eq 0 ]]; then
    pass=$(gopass show -o "$password" 2>/dev/null)
    cliphist=$(cat "$histfile")
    echo "$pass" | wl-copy -n
    sleep 10
    echo "$cliphist" | jq --arg pass "$pass" 'del(.[] | select(. == $pass))' >"$histfile"
else
    pass=$(gopass show -o "$password")
    wtype $pass
fi