Bug 500287 - Using clipboard actions to replace clipboard entry or append to clipboard requires duplicated action.
Summary: Using clipboard actions to replace clipboard entry or append to clipboard req...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Clipboard widget & pop-up (other bugs)
Version First Reported In: 6.3.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2025-02-17 23:01 UTC by JT Hundley
Modified: 2025-02-25 03:09 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 6.3.2
Sentry Crash Report:


Attachments
Demonstrating the clipboard pasting bug (370.32 KB, video/x-matroska)
2025-02-17 23:01 UTC, JT Hundley
Details
screenshot of the clipboard action I used in this testing video. (105.57 KB, image/png)
2025-02-17 23:02 UTC, JT Hundley
Details

Note You need to log in before you can comment on or make changes to this bug.
Description JT Hundley 2025-02-17 23:01:25 UTC
Created attachment 178500 [details]
Demonstrating the clipboard pasting bug

SUMMARY
When using a clipboard action that changes the clipboard, it seemingly doesn't work until you repeat the action a 2nd time.

STEPS TO REPRODUCE
1. Create a clipboard action and edit command, selecting either Replace current clipboard or Append to clipboard.
2. Copy the text you set it to recognize.
3. Execute the action.
4. Try to paste the new text.

OBSERVED RESULT
The correct text appears in the clipboard, but pasting it fails. Selecting the text in the clipboard history does not help. If you repeat the actions of selecting the text and running the action a 2nd time, you'll then be able to properly paste as expected.

EXPECTED RESULT
I expected to be able to paste the text loaded into the clipboard after running the action the first time, as in the previous version of Plasma.

SOFTWARE/OS VERSIONS
Operating System: EndeavourOS 
KDE Plasma Version: 6.3.0
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.2
Kernel Version: 6.13.2-zen1-1-zen (64-bit)
Graphics Platform: X11

Please see attached video for a demonstration.
Comment 1 JT Hundley 2025-02-17 23:02:57 UTC
Created attachment 178501 [details]
screenshot of the clipboard action I used in this testing video.
Comment 2 JT Hundley 2025-02-18 18:28:20 UTC
I just noticed that problem manifests in a different way: A script that I use to copy text to the clipboard using
qdbus org.kde.klipper /klipper setClipboardContents sometext
also triggers the same problem. The clipboard appears to be loaded but cannot paste until it's loaded a 2nd time.
Comment 3 TraceyC 2025-02-18 23:11:06 UTC
I am able to reproduce this on Plasma 6.3.0 as well as git-master using the steps in the report and following the video

Set up clipboard action
Opened KWrite
Started with empty clipboard

1. Typed into KWrite "this is a test"
2. Highlighted the phrase, right click, copy
3. Right clicked (or pressed Ctrl+Alt+R) to bring up the action menu
4. Clicked "test" and tried to paste
Comment 4 JT Hundley 2025-02-18 23:33:42 UTC
For what it's worth, pyqt6's QtWidgets.QApplication([False]).clipboard().setText() seems to work properly.
Comment 5 Fushan Wen 2025-02-19 00:12:05 UTC
Can reproduce, will investigate
Comment 6 Bug Janitor Service 2025-02-21 16:18:59 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/5241
Comment 7 Fushan Wen 2025-02-25 03:05:53 UTC
Git commit 30927e913945a36715d68c891ba09aa872b1df97 by Fushan Wen.
Committed on 25/02/2025 at 02:38.
Pushed by fusionfuture into branch 'master'.

klipper: fix clipboard actions not setting clipboard for the first time

HistoryModel::insert(QString) is for testing purpose only as the
clip data needs some time to be saved, so the overload can't be used to
set the clipboard.

Let ClipCommandProcess manually manipulate the system clipboard and notify
HistoryModel a new clip is available to update the history.
FIXED-IN: 6.3.2

M  +1    -1    CMakeLists.txt
M  +12   -14   appiumtests/applets/clipboardtest.py
M  +1    -1    klipper/CMakeLists.txt
M  +10   -3    klipper/clipcommandprocess.cpp
M  +2    -0    klipper/clipcommandprocess.h
M  +8    -5    klipper/klipper.cpp
M  +59   -55   klipper/systemclipboard.cpp
M  +6    -6    klipper/systemclipboard.h

https://invent.kde.org/plasma/plasma-workspace/-/commit/30927e913945a36715d68c891ba09aa872b1df97
Comment 8 Fushan Wen 2025-02-25 03:09:45 UTC
Git commit c8f84785e59d1cffdbd82b7bc4b448ee124d6c62 by Fushan Wen.
Committed on 25/02/2025 at 03:09.
Pushed by fusionfuture into branch 'Plasma/6.3'.

klipper: fix clipboard actions not setting clipboard for the first time

HistoryModel::insert(QString) is for testing purpose only as the
clip data needs some time to be saved, so the overload can't be used to
set the clipboard.

Let ClipCommandProcess manually manipulate the system clipboard and notify
HistoryModel a new clip is available to update the history.
FIXED-IN: 6.3.2
(cherry picked from commit 30927e913945a36715d68c891ba09aa872b1df97)

M  +1    -1    CMakeLists.txt
M  +12   -14   appiumtests/applets/clipboardtest.py
M  +1    -1    klipper/CMakeLists.txt
M  +10   -3    klipper/clipcommandprocess.cpp
M  +2    -0    klipper/clipcommandprocess.h
M  +8    -5    klipper/klipper.cpp
M  +59   -55   klipper/systemclipboard.cpp
M  +6    -6    klipper/systemclipboard.h

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