From 390c5b280228dbcdaaf8d5489c2686d343558396 Mon Sep 17 00:00:00 2001 From: "J. Elfring" Date: Sun, 3 Nov 2024 19:14:05 +0100 Subject: [PATCH] Filter fzpass passwords from cliphist --- .../dot-config/hypr/hyprland.conf | 3 ++- dotfiles/my-binaries/dot-bin/cliphist-filter | 19 +++++++++++++++++++ dotfiles/my-binaries/dot-bin/fzpass | 10 +++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100755 dotfiles/my-binaries/dot-bin/cliphist-filter diff --git a/dotfiles/hypr-session/dot-config/hypr/hyprland.conf b/dotfiles/hypr-session/dot-config/hypr/hyprland.conf index d8d96a7..a45ee2e 100644 --- a/dotfiles/hypr-session/dot-config/hypr/hyprland.conf +++ b/dotfiles/hypr-session/dot-config/hypr/hyprland.conf @@ -41,7 +41,8 @@ exec-once = waybar exec-once = qpwgraph --minimized exec-once = hypridle exec-once = hyprpaper -exec-once = wl-paste --watch cliphist store +exec-once = wl-paste --watch ~/.bin/cliphist-filter +exec-once = wl-paste --primary --watch ~/.bin/cliphist-filter ############################# diff --git a/dotfiles/my-binaries/dot-bin/cliphist-filter b/dotfiles/my-binaries/dot-bin/cliphist-filter new file mode 100755 index 0000000..c786e51 --- /dev/null +++ b/dotfiles/my-binaries/dot-bin/cliphist-filter @@ -0,0 +1,19 @@ +#!/bin/bash +######################################################### +## +# A filter for cliphist monitoring the clipboards +# in wayland / hyprland. +# When the file ~/.local/cliphist-filter.block is +# present, watched clipboard contents will not be +# pasted into cliphist. +# Start with: +# exec-once = wl-paste --watch ~/.bin/cliphist-filter +# exec-once = wl-paste --primary --watch ~/.bin/cliphist-filter +# from hyprland.conf +# +# / elfrinjo, 2024 +# + +test -e ~/.local/cliphist-filter.block && exit 0 + +cat | cliphist store diff --git a/dotfiles/my-binaries/dot-bin/fzpass b/dotfiles/my-binaries/dot-bin/fzpass index e79dca3..0861e88 100755 --- a/dotfiles/my-binaries/dot-bin/fzpass +++ b/dotfiles/my-binaries/dot-bin/fzpass @@ -44,6 +44,14 @@ C-u: Update (pull, push); C-r: Remove' ## Exit if nothing was selected test "_$password" = "_" && exit +## Disable Clipboard Managers +touch ~/.local/cliphist-filter.block +pgrep --full /usr/bin/clipmenud >/dev/null && clipctl disable + ## Copy pass and show otp, exit silently if anything fails pass show -c "$password" -pass otp "$password" 2>/dev/null || exit 0 +pass otp "$password" 2>/dev/null + +## Re-Enable Clipboard Managers +rm -f ~/.local/cliphist-filter.block +pgrep --full /usr/bin/clipmenud >/dev/null && clipctl disable