Bug 427214 - Add ability to paste Klipper's contents on selection
Summary: Add ability to paste Klipper's contents on selection
Status: CONFIRMED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Clipboard widget & pop-up (show other bugs)
Version: 6.2.90
Platform: Fedora RPMs Linux
: HI wishlist
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: usability
: 428070 474671 478392 478870 487637 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-10-01 17:10 UTC by Max
Modified: 2025-01-20 15:14 UTC (History)
39 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
attachment-3099853-0.html (1.51 KB, text/html)
2024-11-27 13:30 UTC, svlmrc
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Max 2020-10-01 17:10:40 UTC
SUMMARY
Currently user has to perform two operations in most use cases - select the item, and then press CTRL+V (or any other 'paste' command). Will be nice to have an option to simplify it, so that selected clipboard item will be immediately pasted to focused field.

STEPS TO REPRODUCE
1. Open Klipper
2. Select any item with mouse or keyboard arrows + ENTER

OBSERVED RESULT
Klipper closes, and user has to perform another 'paste' operation to make use of selected contents

EXPECTED RESULT
There must be option in settings, which will automatically paste the item on selection

SOFTWARE/OS VERSIONS
KDE Neon: 5.19
Plasma: 5.19.5
KDE Frameworks: 5.74.0
Qt version: 5.15.0

ADDITIONAL INFORMATION
In a similar request on reddit.com it was mentioned that implementing 'paste on selection' in Klipper is not possible, since it doesn't have control over window which needs contents. 
But I think of a workaround, which is - make Klipper just programmatically trigger system's 'paste' command on selection - or at least, the default 'CTRL+V' hotkey. This way application doesn't need to have any control over window or it's elements.
Comment 1 Max 2020-10-01 17:18:27 UTC
Link to mentioned Reddit's topic:
https://www.reddit.com/r/kde/comments/6132ti/klipper_paste_on_enter/
Comment 2 Max 2020-10-01 17:23:52 UTC
Clipboard in Windows already does pasting on selection - as well as the most popular custom clipboard from BetterTouchTool on MacOS. 
So Klipper feels significally behind when it still doesn't have this functionality.
Comment 3 David Edmundson 2020-10-01 21:57:36 UTC
>But I think of a workaround,

It probably would work some of the time, but that's a massive hack to the point that I wouldn't accept it in our codebase.
Comment 4 Max 2020-10-01 22:13:00 UTC
(In reply to David Edmundson from comment #3)
> >But I think of a workaround,
> 
> It probably would work some of the time, but that's a massive hack to the
> point that I wouldn't accept it in our codebase.

I think it should work in most of the cases when user opens clipboard with 'open klipper at mouse position' command, since in this case it's almost always being open with intention to paste contents.

To make it less of a hack, option may be called 'Call keyboard shortcut on item selection' with ability to set any, including 'CTRL+V', — and make it disabled by default.
Comment 5 Max 2020-10-01 22:35:36 UTC
Such an option may also be more explicit, like 'Call 'paste' shortcut on selection', if Klipper has access to the set of System's shortcut and can call any of them. Even though it still will be a hack, I think that the potential usefulness of this solution for users, who work with texts a lot, will outweigh all of the ugliness.
Comment 6 Npov 2021-03-15 04:44:21 UTC
This ability would indeed be useful, as evidenced by support for it on other major platforms. Klipper is excellent and this is the one function I miss.

FWIW I don't feel the proposed approaches (if it comes to that) are too hacky?

Thanks.
Comment 7 Max 2021-03-23 02:19:13 UTC
I ended up using CopyQ utility, which incorporates this feature. It is not integrated in the system as smooth as Klipper, but does it's job very well.
Comment 8 Nate Graham 2021-04-01 20:49:13 UTC
*** Bug 428070 has been marked as a duplicate of this bug. ***
Comment 9 Yman252 2021-08-28 21:50:04 UTC
The automatic paste functionality is the default in every clipboard manager that i've ever used. I just spent 30 minutes searching reddit and google trying to find a workaround, and there has been plenty of people asking how to make this functionality happen, but i haven't found a single workaround. It feels like such a shame to have to use a third party client just because there is no way to make klipper send Control + V after i click the enter key.
Comment 10 Yman252 2021-08-28 22:10:01 UTC
Apologies, i did not read the previous posts in the thread. If the Control + P command is hackish, how about the option to let users add a custom action to be executed after they select an entry? That option already exists for when items get copied to the clipboard. That way a user can find a solution themselves for pasting, be it through xdotool, or something else and it would be up to the user to figure it out, and there would be no hacky solutions on KDE's end.
Comment 11 John 2022-03-05 16:25:10 UTC
Well, this affects me as well!

MS Windows got this right. Even if it pasted the item on "Mouse Middle-Clicking" the entry it would be ok for me, but please, having to select the entry and then paste it is annoying to say the least.

@nate: Doesn't this fits "usability"?
Comment 12 Nate Graham 2022-03-05 22:28:52 UTC
Sure.
Comment 13 Vincenzo Caselli 2022-03-16 00:10:30 UTC
My +1 vote for this useful feature!
Now I'm using CopyQ  for this, but would switch to Klipper with this option available (better as default)
Comment 14 George Melikov 2022-07-04 19:33:48 UTC
+1 for feature,

looks like CopyQ do it via X11 https://github.com/hluk/CopyQ/blob/master/src/platform/x11/x11platformwindow.cpp#L273
Comment 15 David Edmundson 2022-07-04 22:11:20 UTC
>        sendKeyPress(XK_Shift_L, XK_Insert, config);

From my above comment. 

> It probably would work some of the time, but that's a massive hack to the
> point that I wouldn't accept it in our codebase.

That still stands without question.
Comment 16 Nikolas Spiridakis 2022-07-14 22:16:19 UTC
Hello. First of all I understand why having an autopaste option just sending Ctrl+V would be hacky. But having a (disabled by default) option clearly stating "Automatically press Ctrl+V after selection", won't be hacky in any way. The user reading this would understand immediately the implications of it not working as intended in some senarios (for example sending ^V on a terminal or triggering a specific shortcut on an app).

If you still think this is hacky, adding an option to execute a command after a selection would both solve this problem (for us who want to use the hacky ways) and have some other useful uses (like sending the selected clipboard to your phone with a sync service). The backend for this is already there: the action menu. A special action which bypasses the menu and happens automatically will just have to be added. Maybe I should open a new "bug" for this since it technically doesn't solve this issue
Comment 17 kiril.okun 2022-08-15 06:18:32 UTC
+1  On this feature.  It's very surprising and unfortunate that it's not already there.  I've tried a number of clipboard managers on both Windows and MacOS,  and they all pasted immediately upon selection from the history list.   Please consider adding it asap as without this feature Klipper creates too much friction in frequent operation.  So much so, in fact, that i have to switch to an alternative that provides automatic paste.
Comment 18 Nodawos 2022-09-08 15:09:37 UTC
What exactly makes the proposed shortcut solution "hacky"? Considering that nothing better was proposed since then. 
Literally any keyboard manager I tried supports automatic pasting except Klipper, and it's a shame for the built-in clipboard manager, which should contain all most essential functionality out the box.

(In reply to Nikolas Spiridakis from comment #16)
> A special action which bypasses the menu and
> happens automatically will just have to be added

I don't think it should be that complicated. Most users are not even aware of Klipper actions, and likely do not know how to set them. It should be just a simple checkbox in settings, burying such basic functionality so deep is not user friendly at all.
Comment 19 kdebugs 2022-10-25 23:24:28 UTC
+1
Agree with @nodawos685 As long as you have to go and explicitly enable this, and there is a note with the side effects you should be able the shoot yourself in the foot. For me and many other users this is essential feature and even if this is a workaround for X11 what about Wayland?
Comment 20 greg 2022-10-30 13:19:36 UTC
+1
This is the 5th time I've checked into this over the past year or so, finally decided to create an account to add to the chorus asking for this.
I can only assume that theres a bunch of others like me who expect this from their clipboard manager, but cant be bothered with the hassle of commenting.

this is legitimately the second most important feature of a clipboard manager (second only to retaining a history of copied content)

I guess its back to (otherwise inferior) clipboard managers for now, I'll check back in in a few more months
Comment 21 jc 2023-06-12 12:40:17 UTC
+1  I was setting up Klipper today and it surprised me that this was not the default behavior. I agree that there should at least be an option to make this possible.
Comment 22 Dom 2023-07-06 12:49:23 UTC
+1
All other major desktops have had it for a while, it's strange that plasma still lacks this feature
Comment 23 Max 2023-09-09 05:18:48 UTC
(In reply to David Edmundson from comment #3)
> >But I think of a workaround,
> 
> It probably would work some of the time, but that's a massive hack to the
> point that I wouldn't accept it in our codebase.

After seeing exciting new text input possibilites in David's blog, I really hope this request could finally get resolved in Plasma 6. Even better than I expected, with clipboard text preview on the fly! Can't wait for this to happen. 
http://blog.davidedmundson.co.uk/blog/new-ideas-using-wayland-input-methods/
Comment 24 David Edmundson 2023-12-11 14:06:36 UTC
*** Bug 478392 has been marked as a duplicate of this bug. ***
Comment 25 coherence 2024-02-02 19:00:43 UTC
*** Bug 478870 has been marked as a duplicate of this bug. ***
Comment 26 coherence 2024-02-02 19:04:15 UTC
*** Bug 474671 has been marked as a duplicate of this bug. ***
Comment 27 Alex Kao 2024-03-16 16:01:09 UTC
searching for solution for this and end up using CopyQ too, really wish this feature will come true
Comment 28 twoage528 2024-03-18 07:09:17 UTC
still no update on this. i ended up using diodon as it is simple and just works
Comment 29 fanzhuyifan 2024-05-27 18:13:00 UTC
*** Bug 487637 has been marked as a duplicate of this bug. ***
Comment 30 Eugene Savitsky 2024-05-27 18:42:37 UTC
Anyone can add more €€ on a sponsored work topic:
https://discuss.kde.org/t/427214-add-ability-to-paste-klippers-clipboard-contents-on-selection/16234

Let's make KDE great again. :)
Comment 31 Eugene Savitsky 2024-11-10 19:46:55 UTC
No one wants to join on sponsoring the fix? One of most annoying issues I have in Linux, as I heavily copy-paste...

https://discuss.kde.org/t/427214-add-ability-to-paste-klippers-clipboard-contents-on-selection/16234
Comment 32 silverqx 2024-11-18 11:12:41 UTC
The same problem also has an Emoji picker, these problems could be fixed at once, it would be a very helpful fix, much more than anything else. 👌
Comment 33 Black Fawn 2024-11-27 13:23:53 UTC
Another +1 here.

I'm wondering if a KWin Script could be used as a workaround, listening for the Klipper floating window closure action and then triggering paste. It's hackish as hell but it could work.
Comment 34 svlmrc 2024-11-27 13:30:38 UTC
Created attachment 176167 [details]
attachment-3099853-0.html

Wouldn't be a DBus API solve this? I mean, just have a system API that KDE
apps (and others) can call

Il mer 27 nov 2024, 14:23 Black Fawn <bugzilla_noreply@kde.org> ha scritto:

> https://bugs.kde.org/show_bug.cgi?id=427214
>
> Black Fawn <reg-kdebugs@st5.org> changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>                  CC|                            |reg-kdebugs@st5.org
>
> --- Comment #33 from Black Fawn <reg-kdebugs@st5.org> ---
> Another +1 here.
>
> I'm wondering if a KWin Script could be used as a workaround, listening
> for the
> Klipper floating window closure action and then triggering paste. It's
> hackish
> as hell but it could work.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
Comment 35 silverqx 2024-11-27 17:06:06 UTC
I think the correct solution would be to get the foreground window, get element that has a focus in this window, check if it's an editable element, and if yes, then send the last content of the clipboard to this element. The same is true for emoji picker. Nothing easy, you would need to know KDE internals to accomplish this.