Bug 424685 - Add DBus signal for clipboard update
Summary: Add DBus signal for clipboard update
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Clipboard widget & pop-up (show other bugs)
Version: 5.15.3
Platform: unspecified Unspecified
: NOR wishlist
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-26 14:53 UTC by admin
Modified: 2023-04-10 13:55 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description admin 2020-07-26 14:53:57 UTC
SUMMARY
The klipper-managed clipboard can be polled via the DBus org.kde.klipper.klipper.getClipboard* methods. Please add a DBus signal notifying of updated clipboard content so that polling can be avoided.
Comment 1 David Edmundson 2020-07-26 16:18:40 UTC
Can you expand on why you're querying klipper for clipboard instead of just watching the clipboard directly?

I'm asking because I might get rid of that interface for wayland security anyway.
Comment 2 Bug Janitor Service 2020-08-10 04:33:11 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 3 Bug Janitor Service 2020-08-25 04:33:10 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!
Comment 4 admin 2020-10-18 15:49:31 UTC
Apologies for the late reply.

The idea is having a means of taking action automatically on updated clipboard content without polling. As far as I can make out, Klipper actions cannot serve this purpose as they require user interaction for action commands to execute.

Being able to define Klipper actions that immediately and without user intervention execute commands when the regex is matched would also provide a solution to avoiding polling.

I don't think the X clipboard has a poll-free interface. Moreover, by using Klipper, things will keep on working when moving over to Wayland.
Comment 5 Björn Bidar (Thaodan) 2022-09-16 07:34:47 UTC
(In reply to David Edmundson from comment #1)
> Can you expand on why you're querying klipper for clipboard instead of just
> watching the clipboard directly?
> 
> I'm asking because I might get rid of that interface for wayland security
> anyway.

Hey, I want chime on this. One use case is to sync programs with separate clipboard/kill-rings.

For example user I want to sync the kill-ring of Emacs with Klipper. On way is to poll Klipper contiguously for updates however it would be far easier and less time consuming to have a dbus signal whenever the klipboard contents change.
Comment 6 Björn Bidar (Thaodan) 2022-09-16 13:09:50 UTC
Wip PR that addresses this feature:
https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2126
Comment 7 Nate Graham 2023-04-10 13:55:10 UTC
Git commit f3830cd8e379ce72f5307e1bef0d071c98d7e979 by Nate Graham, on behalf of Björn Bidar.
Committed on 10/04/2023 at 13:54.
Pushed by ngraham into branch 'master'.

klipper: Expose DBus signal to tell when clipboardHistory was updated

The signal can be used to watch for changes on the clipboard for
example to wait for the users input on other program or interoperate
in any other way.

An example use case is if a user want to sync the kill-ring of Emacs
or any other Editor with Klipper.
FIXED-IN: 6.0

Signed-off-by: Björn Bidar <bjorn.bidar@thaodan.de>

M  +4    -1    klipper/klipper.cpp
M  +1    -0    klipper/klipper.h

https://invent.kde.org/plasma/plasma-workspace/commit/f3830cd8e379ce72f5307e1bef0d071c98d7e979