retitle 725653 --clip copies to CLIPBOARD, I'd prefer PRIMARY selection
tags 725653 + patch
thanks

Hi,

I’ve decided to just copy to both. The attached patch –
untested of course ;-) – does that; xsel(1) is able to
keep it in memory by forking a dæmon subprocess that’s
ended as soon as it’s no longer needed.

(I just did this because Dominik complained about X and/or
joeyh, sitting on my couch, and I know/use xsel so I know
a way to do this.)

Have fun!

bye,
//mirabilos
-- 
<mirabilos>    │ untested
<Natureshadow> │ tut natürlich
<Natureshadow> │ was auch sonst ...
<mirabilos>    │ fijn ☺
diff -Nru password-store-1.4.2/debian/changelog 
password-store-1.4.2/debian/changelog
--- password-store-1.4.2/debian/changelog       2012-11-30 13:19:19.000000000 
+0100
+++ password-store-1.4.2/debian/changelog       2013-10-17 22:14:18.000000000 
+0200
@@ -1,3 +1,11 @@
+password-store (1.4.2-1.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Write to both CLIPBOARD and PRIMARY selection, using xsel(1) which,
+    unlike xclip, is able to keep the latter in memory (closes: #725653).
+
+ -- Thorsten Glaser <t...@mirbsd.de>  Thu, 17 Oct 2013 22:11:40 +0200
+
 password-store (1.4.2-1) unstable; urgency=low
 
   * New upstream release (closes: #694772).
diff -Nru password-store-1.4.2/debian/control 
password-store-1.4.2/debian/control
--- password-store-1.4.2/debian/control 2012-11-30 13:14:38.000000000 +0100
+++ password-store-1.4.2/debian/control 2013-10-17 22:00:57.000000000 +0200
@@ -9,7 +9,7 @@
 Package: pass
 Architecture: all
 Depends: ${misc:Depends}, pwgen, gnupg2, tree
-Recommends: git, xclip
+Recommends: git, xsel
 Suggests: perl, libxml-simple-perl, python, ruby
 Description: lightweight directory-based password manager
  Stores, retrieves, generates, and synchronizes passwords securely using
diff -Nru password-store-1.4.2/debian/patches/better-clipboard.patch 
password-store-1.4.2/debian/patches/better-clipboard.patch
--- password-store-1.4.2/debian/patches/better-clipboard.patch  1970-01-01 
01:00:00.000000000 +0100
+++ password-store-1.4.2/debian/patches/better-clipboard.patch  2013-10-17 
22:11:27.000000000 +0200
@@ -0,0 +1,86 @@
+# DP: Use xsel instead of xclip, to write to both PRIMARY and CLIPBOARD
+# DP: selections when --clip is used, and to keep PRIMARY in memory.
+# DP: (Closes: #725653)
+
+--- a/README
++++ b/README
+@@ -19,8 +19,8 @@ Depends on:
+   http://www.gnupg.org/
+ - git
+   http://www.git-scm.com/
+-- xclip
+-  http://sourceforge.net/projects/xclip/
++- xsel
++  http://www.vergenet.net/~conrad/software/xsel/
+ - pwgen
+   http://sourceforge.net/projects/pwgen/
+ - tree
+--- a/man/pass.1
++++ b/man/pass.1
+@@ -72,7 +72,7 @@ program. This command is alternatively n
+ Decrypt and print a password named \fIpass-name\fP. If \fI--clip\fP or 
\fI-c\fP
+ is specified, do not print the password but instead copy the first line to the
+ clipboard using
+-.BR xclip (1)
++.BR xsel (1)
+ and then restore the clipboard after 45 seconds.
+ .TP
+ \fBinsert\fP [ \fI--echo\fP, \fI-e\fP | \fI--multiline\fP, \fI-m\fP ] [ 
\fI--force\fP, \fI-f\fP ] \fIpass-name\fP
+@@ -99,7 +99,7 @@ of length \fIpass-length\fP and insert i
+ is specified, do not use any non-alphanumeric characters in the generated 
password.
+ If \fI--clip\fP or \fI-c\fP is specified, do not print the password but 
instead copy
+ it to the clipboard using
+-.BR xclip (1)
++.BR xsel (1)
+ and then restore the clipboard after 45 seconds. Prompt before overwriting an 
existing password,
+ unless \fI--force\fP or \fI-f\fP is specified.
+ .TP
+@@ -345,7 +345,7 @@ The location of the text editor used by
+ .BR gpg2 (1),
+ .BR pwgen (1),
+ .BR git (1),
+-.BR xclip (1).
++.BR xsel (1).
+ 
+ .SH AUTHOR
+ .B pass
+--- a/src/password-store.sh
++++ b/src/password-store.sh
+@@ -81,17 +81,19 @@ yesno() {
+ # BEGIN Platform definable
+ #
+ clip() {
+-      # This base64 business is a disgusting hack to deal with newline 
inconsistancies
+-      # in shell. There must be a better way to deal with this, but because 
I'm a dolt,
+-      # we're going with this for now.
+-
+-      before="$(xclip -o -selection clipboard | base64)"
+-      echo -n "$1" | xclip -selection clipboard
++      before_clipboard=$(xsel -o -b)
++      before_primary=$(xsel -o -p)
++      printf '%s' "$1" | xsel -i -b
++      printf '%s' "$1" | xsel -i -p
+       (
+               sleep 45
+-              now="$(xclip -o -selection clipboard | base64)"
+-              if [[ $now != $(echo -n "$1" | base64) ]]; then
+-                      before="$now"
++              now_clipboard=$(xsel -o -b)
++              now_primary=$(xsel -o -p)
++              if [[ $now_clipboard = "$1" ]]; then
++                      printf '%s' "$before_clipboard" | xsel -i -b
++              fi
++              if [[ $now_primary = "$1" ]]; then
++                      printf '%s' "$before_primary" | xsel -i -p
+               fi
+ 
+               # It might be nice to programatically check to see if klipper 
exists,
+@@ -102,8 +104,6 @@ clip() {
+               # 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 | xclip -selection clipboard
+       ) & disown
+       echo "Copied $2 to clipboard. Will clear in 45 seconds."
+ }
diff -Nru password-store-1.4.2/debian/patches/series 
password-store-1.4.2/debian/patches/series
--- password-store-1.4.2/debian/patches/series  1970-01-01 01:00:00.000000000 
+0100
+++ password-store-1.4.2/debian/patches/series  2013-10-17 22:00:30.000000000 
+0200
@@ -0,0 +1 @@
+better-clipboard.patch

Reply via email to