Bug 433837

Summary: Can't copy text from text fields in rules KCM from in KWin-launched rules dialog
Product: [Plasma] kwin Reporter: Dan Dascalescu <ddascalescu+kde>
Component: rulesAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: isma.af, nate
Priority: NOR Keywords: wayland
Version: 5.21.1   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.22
Attachments: I wanted to copy the exact "org.kde.plasmawindowed" text for another bug

Description Dan Dascalescu 2021-03-02 06:39:23 UTC
Created attachment 136309 [details]
I wanted to copy the exact "org.kde.plasmawindowed" text for another bug

SUMMARY


STEPS TO REPRODUCE
1. Invoke the window context menu (Alt+F3)
2. More Actions
3. Configure Special Window Settings
3. Try to copy the "Description" text

OBSERVED RESULT
Can select the text, but Ctrl+C or Ctrl+Insert doesn't copy it to the clipboard, and there is no context menu to copy it


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.21.1.
KDE Frameworks Version: 5.79.0
Qt Version: 5.12.5

ADDITIONAL INFORMATION
Wayland
Comment 1 Nate Graham 2021-03-02 19:00:16 UTC
Can confirm, though interestingly enough, both Ctrl+C and right-click do the right thing when this KCM is invoked from within System Settings or even using `kcmshell5 kcm_kwinrules` on the command line.

My conclusion is that KWin's invocation of this KCM in a custom dialog is not hooking into plasma-integration or some other necessary piece.
Comment 2 Ismael Asensio 2021-03-02 20:26:20 UTC
I checked it's not happening on X11.

The intended way forward is to stop using a custom dialog with the embedded editor and use the full KCM also when launched from kwin (https://invent.kde.org/plasma/kwin/-/merge_requests/134). 

This would fix this bug and also some other ones, while simplifying the codepaths, but also has currently some drawbacks. 

Of course we also may find a specific fix for this bug, but I don't know enough about wayland clipboard mechanisms to guess a cause.
Comment 3 Nate Graham 2021-03-02 20:27:36 UTC
It's happening to me on X11, BTW.

I agree that deleting the custom dialog is the way forward.
Comment 4 Ismael Asensio 2021-03-19 04:01:36 UTC
Git commit a82be242ea207fb5c7384d2be7703456b368a414 by Ismael Asensio.
Committed on 19/03/2021 at 03:16.
Pushed by iasensio into branch 'master'.

[kwinrules] Launch full KCM when editing from window menu

When rules configuration is invoked from window `Alt+F3` menu,
we call a custom binary `kwin_rules_dialog` which currently provides
only the rule edition dialog by embedding `RulesEditor.qml` within a
QQuickView.

This MR changes that behavior to call the full KCM from the menu.
The code to match previous rules, or compose a new one based on window
properties has been ported to the KCM from the dialog, so the overall
interaction is similar.

It has several advantages:
 - uses only one entry-point to the code
 - adds discoverability to the full KCM (I guess many users know how to
   create a rule, but not where to delete it later)

And a drawback:
 - only one instance of the KCM can be called at a time, so it will show an
   error when calling it from two different windows, or if the KCM is open
   in System Settings

This drawback can be solved after adding argument passing via dBus in KCM
infraestructure.
Related: bug 417923

M  +4    -2    src/kcmkwin/kwinrules/CMakeLists.txt
M  +162  -3    src/kcmkwin/kwinrules/kcmrules.cpp
M  +7    -0    src/kcmkwin/kwinrules/kcmrules.h
M  +29   -211  src/kcmkwin/kwinrules/main.cpp
M  +7    -9    src/kcmkwin/kwinrules/package/contents/ui/RulesEditor.qml
M  +86   -0    src/kcmkwin/kwinrules/rulebookmodel.cpp
M  +2    -0    src/kcmkwin/kwinrules/rulebookmodel.h
D  +0    -74   src/kcmkwin/kwinrules/rulesdialog.cpp
D  +0    -41   src/kcmkwin/kwinrules/rulesdialog.h

https://invent.kde.org/plasma/kwin/commit/a82be242ea207fb5c7384d2be7703456b368a414