[pass] [PATCH 2/2] Add support for GPaste

Marc-Antoine Perennou Marc-Antoine at perennou.com
Mon Sep 7 14:16:54 CEST 2015


Any news on this feature?

On 11 May 2015 at 16:08, Marc-Antoine Perennou
<Marc-Antoine at perennou.com> wrote:
> Signed-off-by: Marc-Antoine Perennou <Marc-Antoine at Perennou.com>
> ---
>  src/password-store.sh | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/src/password-store.sh b/src/password-store.sh
> index 06fb33f..5c1a8ad 100755
> --- a/src/password-store.sh
> +++ b/src/password-store.sh
> @@ -152,10 +152,31 @@ clip_xclip() {
>                 echo "$before" | base64 -d | xclip -selection "$X_SELECTION"
>         ) 2>/dev/null & disown
>  }
> +clip_gpaste() {
> +       # GPaste is a clipboard manager with built-in password support
> +       # it will never write it to disk or print it unless you paste it
> +       local sleep_argv0="$1"
> +       shift
> +       if echo -n "$1" | gpaste add-password "$2" >/dev/null 2>&1; then
> +               (
> +                       ( exec -a "$sleep_argv0" sleep "$CLIP_TIME" )
> +                       gpaste delete-password "$2"
> +               ) 2>/dev/null & disown
> +       else
> +               # fallback to xclip
> +               clip_xclip "$sleep_argv0" "$@"
> +       fi
> +}
>  clip() {
>         local sleep_argv0="password store sleep on display $DISPLAY"
>         pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
> -       clip_xclip "$sleep_argv0" "$@"
> +       local gpaste=0
> +       gpaste help | grep -q password && gpaste=1
> +       if [[ $gpaste -eq 1 ]]; then
> +               clip_gpaste "$sleep_argv0" "$@"
> +       else
> +               clip_xclip "$sleep_argv0" "$@"
> +       fi
>         echo "Copied $2 to clipboard. Will clear in $CLIP_TIME seconds."
>  }
>  tmpdir() {
> --
> 2.3.3
>


More information about the Password-Store mailing list