Files
Foundry/overlays/pass-wlclipboard-secret.diff

47 lines
1.8 KiB
Diff

diff --git a/src/password-store.sh b/src/password-store.sh
index a0dcf2e..0723cf7 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -156,7 +156,7 @@ check_sneaky_paths() {
clip() {
if [[ -n $WAYLAND_DISPLAY ]]; then
- local copy_cmd=( wl-copy )
+ local copy_cmd=( wl-copy -t text/secret )
local paste_cmd=( wl-paste -n )
if [[ $X_SELECTION == primary ]]; then
copy_cmd+=( --primary )
@@ -170,31 +170,8 @@ clip() {
else
die "Error: No X11 or Wayland display detected"
fi
- local sleep_argv0="password store sleep on display $display_name"
-
- # This base64 business is because bash cannot store binary data in a shell
- # variable. Specifically, it cannot store nulls nor (non-trivally) store
- # trailing new lines.
- pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
- local before="$("${paste_cmd[@]}" 2>/dev/null | $BASE64)"
echo -n "$1" | "${copy_cmd[@]}" || die "Error: Could not copy data to the clipboard"
- (
- ( exec -a "$sleep_argv0" bash <<<"trap 'kill %1' TERM; sleep '$CLIP_TIME' & wait" )
- local now="$("${paste_cmd[@]}" | $BASE64)"
- [[ $now != $(echo -n "$1" | $BASE64) ]] && before="$now"
-
- # It might be nice to programatically check to see if klipper exists,
- # as well as checking for other common clipboard managers. But for now,
- # this works fine -- if qdbus isn't there or if klipper isn't running,
- # this essentially becomes a no-op.
- #
- # Clipboard managers frequently write their history out in plaintext,
- # so we axe it here:
- qdbus org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory &>/dev/null
-
- echo "$before" | $BASE64 -d | "${copy_cmd[@]}"
- ) >/dev/null 2>&1 & disown
- echo "Copied $2 to clipboard. Will clear in $CLIP_TIME seconds."
+ echo "Copied $2 to clipboard."
}
qrcode() {