bboozzoo / mconnect

mconnect - KDE Connect protocol implementation in Vala/C
GNU General Public License v2.0
274 stars 27 forks source link

no clipboard sharing? #35

Open emacsomancer opened 6 years ago

emacsomancer commented 6 years ago

So I got mconnect working on my machine, and can get everything working it seems (well, no indicator) except for clipboard sharing. I can manually do this (from laptop to phone) via 'share-text' (though nothing the other direction) but it doesn't actually sync clipboards otherwise.

bboozzoo commented 6 years ago

Thanks for reporting this. Indeed, there's some thing fishy going on. Here's the log from selecting and copying some text on Android:

** (mconnect:20429): DEBUG: received line: {"id":1512908938339,"type":"kdeconnect.clipboard","body":{"content":" programs creates lots of trivial changes, which makes"}}
** (mconnect:20429): DEBUG: packet type: kdeconnect.clipboard
** (mconnect:20429): DEBUG: got packet
** (mconnect:20429): DEBUG: devicechannel.vala:282: check for IO, conditions: 0x1
** (mconnect:20429): DEBUG: received line: {"id":1512908945880,"type":"kdeconnect.clipboard","body":{"content":"machine-to-machine communication"}}
** (mconnect:20429): DEBUG: packet type: kdeconnect.clipboard
** (mconnect:20429): DEBUG: got packet
** (mconnect:20429): DEBUG: devicechannel.vala:282: check for IO, conditions: 0x1
** (mconnect:20429): DEBUG: received line: {"id":1512908945878,"type":"kdeconnect.clipboard","body":{"content":""}}
** (mconnect:20429): DEBUG: packet type: kdeconnect.clipboard
** (mconnect:20429): DEBUG: got packet

No clue why it's sending the kdeconnect.clipboard packet with content set to "". The simplest fix would be to ignore such packet. Would you like to open a PR?

donRaphaco commented 6 years ago

I think the problem is that clipboard events are not handled by the the server. As you can see in the log right after the server starts (also I searched through the code):

** (mconnect:19790): DEBUG: device.vala:579: added: kdeconnect.clipboard
** INFO: devicemanager.vala:205: capability kdeconnect.clipboard added to device xxxxxxxxxxxxxxxx-X-phone-X

** (mconnect:19790): WARNING **: devicemanager.vala:218: no handler for capability kdeconnect.clipboard

But there is another way to share text from phone to laptop: If you share simple text with the kde-connect app, the text will be copied into the clipboard of your laptop. On Android for example you can click on share when text is selected (by tap-holding). screenshot_20180104-210957