bugaevc / wl-clipboard

Command-line copy/paste utilities for Wayland
GNU General Public License v3.0
1.62k stars 60 forks source link

Can't paste a PGP key copied with wl-copy #44

Closed mh-cbon closed 5 years ago

mh-cbon commented 5 years ago

Hi,

Thanks for the package!

I have a small issue, unfortunately, with this command

gpg --export -a test@test.com | wl-copy

It does not work when i try to paste data.

However!, this works

echo "test" | wl-copy

FYI, its not related to fds, and i confirm i run wayland

$ echo $XDG_SESSION_TYPE
wayland

$ echo "test" 1>/dev/null
$ gpg --export -a test@test.com 1>/dev/null
$ echo "test" 2>/dev/null
test
$ gpg --export -a test@test.com 2>/dev/null
-----BEGIN PGP PUBLIC KEY BLOCK-----
... 
bugaevc commented 5 years ago

It definitely can handle multiline text.

It does not work when i try to paste data.

Does not work how? Doesn't paste anything? Pastes the first line?

How are you pasting (in what app, via Wayland or XWayland)? Does pasting the GPG key with wl-paste work?

mh-cbon commented 5 years ago

when i try to copy the pasted data with both wl-paste and regular paste shortcut, it is empty.

I m running those command from a terminal, gnome-term

I have retried this morning, and it worked..... Im unsure what happens here, but good news. let me close the ticket. If i face the problem again i ll be back....

$ gpg --export -a test@test.com | wl-copy 
$ wl-paste 
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQENBFzlmaoBCAC764lfAAl/mb6k67/nnipsFfnP12YKy9iVq/yU8AcIdgT9m6x4
lF8XOyh+zYu9X+Zb/aeUnkrehl4ldLOaVvCSLNLZSfGz5Z7Xsa3MthXOvMeq7hWy
zeGKVyIbq9/OoryGdmBFOySgXg/urFeUPx/tgFls0ScvNboQc3dl4aEvMdWlEXWM
x9bvIRW+abdONeazd9EdXGZJO6o9+Ad8I916k3nAPo55DyRkCbi3cIURut7z9ZRe
1R8nYrSDqd7IYacuaBoYX18BHRhUA7Ajh/hLLmKJQXEbQv8aMKPcbU7ixQAvbyE9
zj0P7rtxCTgJcmvDohSK40C98tVMuLniEOVBABEBAAG0G3Rlc3QgKHRlc3QpIDx0
ZXN0QHRlc3QuY29tPokBIgQTAQg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hGy4E3/QJUGz3UhneqVdHGCwHezLpU35SplkzafY3+X9E8Gu9PtoeVpLQ
+yLoNw==
=Tjd9
-----END PGP PUBLIC KEY BLOCK-----
mh-cbon commented 5 years ago

The issue i have is that i can t paste the newly copied data into firefox or gedit.

bugaevc commented 5 years ago

Aha. What does wl-paste --list-types say if you run it after copying?

I guess this is another variant of #46

mh-cbon commented 5 years ago

See, it is a little weird, the first type list does not make any sense, re pasting gives better results.

$ gpg --export -a test@test.com | wl-copy
$ wl-paste --list-types
TIMESTAMP
TARGETS
MULTIPLE
SAVE_TARGETS
text/html
text/_moz_htmlcontext
text/_moz_htmlinfo
text/plain;charset=utf-8
UTF8_STRING
COMPOUND_TEXT
TEXT
STRING
text/plain;charset=utf-8
text/plain
text/x-moz-url-priv
 $ gpg --export -a test@test.com | wl-copy 
 $ wl-paste --list-types
application/pgp-keys

IDK.

However, i gave it a try with a regular file, it worked as expected.

$ cat main.go | wl-copy 
 $ wl-paste --list-types
UTF8_STRING
COMPOUND_TEXT
TEXT
STRING
text/plain;charset=utf-8
text/plain
SAVE_TARGETS
 $ cat main.go | wl-copy 
 $ wl-paste --list-types
text/plain
text/plain;charset=utf-8
TEXT
STRING
UTF8_STRING
text/plain
bugaevc commented 5 years ago

See, it is a little weird, the first type list does not make any sense, re pasting gives better results.

Are you by any change using some sort of clipboard manager? Maybe under X11 via XWayland? That first list if types doesn't look like it's coming from wl-clipboard, perhaps something else takes over the selection between your invoking wl-copy and wl-paste

mh-cbon commented 5 years ago

yes i noticed their was a focus change while doing the paste, but i did not bothered.

Doing something like this always triggers a focus change, and their a notification in gnome to say that the program ended running, very much like you ran it in a background window. * yet it does give the focus back to the window I am working in.

$ gpg --export -a test@test.com | wl-copy; wl-paste --list-types
TIMESTAMP
TARGETS
MULTIPLE
SAVE_TARGETS
text/html
text/_moz_htmlcontext
text/_moz_htmlinfo
text/plain;charset=utf-8
UTF8_STRING
COMPOUND_TEXT
TEXT
STRING
text/plain;charset=utf-8
text/plain
text/x-moz-url-priv
$ gpg --export -a test@test.com | wl-copy; wl-paste --list-types
application/pgp-keys
$ gpg --export -a test@test.com | wl-copy; wl-paste --list-types
No selection
$ gpg --export -a test@test.com | wl-copy; wl-paste --list-types
No selection

It might be i have installed something long time ago.... maybe, i need to recall.

Its kind of random : /

$ cat main.go | wl-copy ; wl-paste --list-types 
text/plain
text/plain;charset=utf-8
TEXT
STRING
UTF8_STRING
text/plain
 $ cat main.go | wl-copy ; wl-paste --list-types 
text/plain
text/plain;charset=utf-8
TEXT
STRING
UTF8_STRING
text/plain
 $ cat main.go | wl-copy ; wl-paste --list-types 
No selection
 $ cat main.go | wl-copy ; wl-paste --list-types 
text/plain
text/plain;charset=utf-8
TEXT
STRING
UTF8_STRING
text/plain
 $ 
mh-cbon commented 5 years ago

hi, new master seems to work like a charm. bugs i encountered are fixed! I still have the focus switch, but it is not bothering a lot as it focuses back. thanks!

bugaevc commented 5 years ago

Yay! :smile: