Bug 392164

Summary: Button for sharing clipboard content
Product: [Applications] kdeconnect Reporter: Rokas Kupstys <rokupstys>
Component: commonAssignee: Albert Vaca Cintora <albertvaka>
Status: CONFIRMED ---    
Severity: wishlist CC: gerion.entrup, gik-kbugs, inbox, karl, kde, mikhail-bugs-kde-org, nate, rokupstys, roy-orbitson, simgunz, voidpointertonull+bugskdeorg
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:

Description Rokas Kupstys 2018-03-22 07:41:20 UTC
It would be extremely convenient if there was a button to send clipboard contents between devices. Clipboard sharing plugin as cool as it is, is suboptimal and can be considered a security hazard. I very rarely need to share PC clipboard with my phone. Naturally i do not want ALL of my clipboard be tunneled to the phone all the time. Sensitive information like passwords may be copied on PC and there is no reason for it to end up on the phone by default.

Feature i propose would be a [Send clipboard] button in both plasmoid and android application. Clicking this button on PC would send PC clipboard to the phone and vice versa. There probably should be toggle in clipboard plugin settings for implicit or explicit clipboard sharing in order to preserve current behaviour.
Comment 1 Karl Ove Hufthammer 2018-04-14 11:03:30 UTC
I was just going to file this exact feature request! I too like the ability to share the clipboard between devices, but I’m not very comfortable with *every little thing* (including passwords) I copy to the clipboard automatically being shared with my phone and all its apps.

I suggest also adding ‘Send clipboard’ to the right-click menu of the tray icon. If the user has several devices, this would send it to all of the devices. And/or there could be an additional ‘Send clipboard to’ menu item with a sub-menu for selecting which device to send the clipboard to.
Comment 2 Mikhail Khvoinitsky 2021-09-14 23:44:55 UTC
+1 who came to file the same feature request.

I wanted to emphasize the importance of such feature from the security perspective. It's not some hypothetical threat. Recently, I've found out that my Samsung Tablet keyboard maintains a clipboard history (which I didn't asked for) where I was able to find a big list of my passwords (!) which I copied from KeePassXC on the desktop in the past and which KDE Connect had been carefully syncing. The clipboard history feature itself is insane, no doubt, which I've disabled (which wasn't as straightforward as you would expect, it required some hacks with adb (!!)), but less recklessness from KDE Connect is much expected. Still, Samsung keyboard flashes your clipboard content if it's not empty. Who knows which other apps does something nasty with your clipboard.

As far as I can see, this feature has already been implemented on Android (which is much appreciated) but not on Linux.
Comment 3 Gerion 2021-09-15 10:58:50 UTC
*** Bug 386568 has been marked as a duplicate of this bug. ***
Comment 4 Gerion 2021-09-15 11:01:51 UTC
Coming from bug 386568, I want to make a concretization. Would it be possible to implement for every device this option:

----
Share the own clipboard with all connected devices:
() always
() on request (a button will be shown)
() never
----

Default setting will be "on request"?
Comment 5 Will Chen 2022-11-22 07:59:31 UTC
This type of functionality is actually already available in the "Share and receive" plugin. On Android, it is exposed via the phone's "Share" context menu— Select some text, share it with KDE Connect, and KWrite will open on the Desktop with the text. On Desktop, it is currently exposed by `kdeconnect-cli --share-text`— E.G. `kdeconnect-cli -d <DEVICE_ID> --share-text "$(xclip -o -selection clipboard)"` to send the clipboard.

I've opened a MR to add a button in the tray Plasmoid to send the current clipboard:
https://invent.kde.org/network/kdeconnect-kde/-/merge_requests/508

Personally I don't really see the need to complicate the clipboard plugin by adding an option for explicit sharing of text. The "Share" plugin, which is designed specifically for explicit sharing, can already do the same thing if it is exposed in the UI.
Comment 6 Gerion 2022-11-22 14:02:37 UTC
(In reply to Will Chen from comment #5)
> This type of functionality is actually already available in the "Share and
> receive" plugin.

Hmm, interesting thought. If I get it right, this is always equal on both sides, isn't it? I'm really interested in a mode:
- Share only on request from PC to Smartphone.
- Share always from Smartphone to PC.
- (Maybe also: Share always from PC to PC.)

Background: I trust my PC(s) way more than my smartphone and copy passwords on a regular base on the PC but almost never on the smartphone. However, I think automatic sharing from the smartphone is more convenient than explicit sharing.

Also, opening the text in KWrite requires one step more for URLs for example, because you have to copy them in KWrite a second time to paste it in your browser. Also, it is possible to share certain part of a text within another app on Android? For example some intresting parts of a chat message. On Android, I would long press on that, choose the interesting part and press copy.
Additionally, what do you think of an extension of the plasmoid?:
- On the smartphone: Share some text with KDE Connect.
- The plasmoid on the PC pops up, shows: "Text {xy} was shared. How do you want to continue: 1. Copy, 2. Open with program 3. Save to file". For the open with program, maybe some autorecognition works, which opens URLs with a Browser/Gwenview/... where the default is opening with KWrite etc.)
Comment 7 Roy Orbitson 2022-11-22 23:46:24 UTC
FWIW, the Android app now seems to require explicit copying of the clipboard via a user action, though I think it's a consequence of an API change for security rather than a deliberate choice. A small system toast appears that mentions which app has "pasted" (read) from the clipboard upon tapping the menu item. Prefs at both ends to choose the level of sharing is ideal, and still relevant to older Android versions.

A bit related, using an app that can type passwords as a keyboard into KDE Connect's Remote Input interface is better than copy + paste, e.g. KeePassDX.
Comment 8 Will Chen 2022-11-25 01:39:45 UTC
(In reply to Gerion from comment #6)

> Hmm, interesting thought. If I get it right, this is always equal on both sides, isn't it? I'm really interested in a mode:
> - Share only on request from PC to Smartphone.
> - Share always from Smartphone to PC.
> - (Maybe also: Share always from PC to PC.)

I think I *personally* would probably leave the "Clipboard" plugin disabled and prefer to use the "Share" plugin even if the former did have such a mode, so as a single user I suppose I don't agree that there needs to be a separate mode. Well, Unix philosophy and all that, it just seems like a significant amount of added complexity for not much gain when the "Share" plugin already does much the same job.

Because I personally wouldn't use it, I suppose I'm not the best person to comment on the idea. I do think that having some explicit text sharing capability is better than having none, though, even if the workflow can be improved.

> Additionally, what do you think of an extension of the plasmoid?:
> - On the smartphone: Share some text with KDE Connect.

The feature overlap could also create a collision in the UI I think. (Or have I misunderstood? Is this about Clipboard, or Share?) Currently explicit text sharing on the smartphone already invokes the "Share" plugin. Would it be replaced with the "Clipboard" plugin, then? So then will the "Share" plugin's text feature be exposed at all, or basically just dead code? What if the "Clipboard" plugin isn't set to that mode, or isn't enabled at all? And personally I think "Explicit text sharing can be configured in the right (Clipboard) plugin" would be a subjective UX regression for me from "Explicit text sharing is available by default with the right (Share) plugin"— That may be again specific to how I would personally prefer to use KDE Connect though. Will there be two "KDE Connect" options in the Android sharing menu, one for the "Share" plugin and one for the "Clipboard" plugin, that do basically the same thing? — Not unresolvable, but I suppose something that should be thought about.

> - The plasmoid on the PC pops up, shows: "Text {xy} was shared. How do you want to continue: 1. Copy, 2. Open with program 3. Save to file". For the open with program, maybe some autorecognition works, which opens URLs with a Browser/Gwenview/... where the default is opening with KWrite etc.

Efficiency/steps-wise, I think adding a prompt on PC for what to do would create mostly the same situation as the current behaviour of popping up KWrite. You can already Copy/Save/whatever right away as soon as KWrite pops up— I suppose opening with other programs would be half a step less— Can Gwenview open web addresses? Or would that only be useful for web browsers?

I do think it would look nicer and make it clearer what's happened though.

> Also, it is possible to share certain part of a text within another app on Android? For example some intresting parts of a chat message. On Android, I would long press on that, choose the interesting part and press copy.

If I understand this correctly, from the menu that says "Copy", there should also be/is a "Share" option that lets the text be send to KDE Connect, I think.
Comment 9 Gerion 2022-11-25 09:54:29 UTC
(In reply to Will Chen from comment #8)
> (In reply to Gerion from comment #6)
> > Additionally, what do you think of an extension of the plasmoid?:
> > - On the smartphone: Share some text with KDE Connect.
> 
> The feature overlap could also create a collision in the UI I think. (Or
> have I misunderstood? Is this about Clipboard, or Share?) 

I meant that for the Share option. I though about how convenient it would be to replace Clipboard by Share.
I, for example, regularly use the clipboard sharing for URLs, which currently involves theses steps:
1. Long click on Android on the URL.
2. Press copy.
3. Press "PP" in qutebrowser.

Using sharing in the current form would involve:
1. Long click on Android on the URL.
2. Press Share.
3. Select KDE Connect.
4. Mark the text in KWrite.
5. Press Ctrl-C / Rightclick->Copy.
6. Press "PP" in qutebrowser.

> > - The plasmoid on the PC pops up, shows: "Text {xy} was shared. How do you want to continue: 1. Copy, 2. Open with program 3. Save to file". For the open with program, maybe some autorecognition works, which opens URLs with a Browser/Gwenview/... where the default is opening with KWrite etc.
> 
> Efficiency/steps-wise, I think adding a prompt on PC for what to do would
> create mostly the same situation as the current behaviour of popping up
> KWrite. You can already Copy/Save/whatever right away as soon as KWrite pops
> up— I suppose opening with other programs would be half a step less— Can
> Gwenview open web addresses? Or would that only be useful for web browsers?

Yes, Gwenview (most KDE programs) opens URLs directly, if the type is suitable. For example, clicking on a picture link in KMail opens Gwenview, since KDE has some autodetection to what MIME type the URL points. Maybe sharing with KDE Connect does exactly this yet (I have not tried it): Open the best program suitable, in case of text this would be KWrite.


> > Also, it is possible to share certain part of a text within another app on Android? For example some intresting parts of a chat message. On Android, I would long press on that, choose the interesting part and press copy.
> 
> If I understand this correctly, from the menu that says "Copy", there should
> also be/is a "Share" option that lets the text be send to KDE Connect, I
> think.

AFAIK, this option does not exist and since this is Android core functionality, it is not something that KDE (Connect) can change.