https://bugs.kde.org/show_bug.cgi?id=527719

            Bug ID: 527719
           Summary: KRFB on Wayland does not synchronize text clipboard
                    with VNC clients in either direction
    Classification: Applications
           Product: krfb
      Version First 26.04.3
       Reported In:
          Platform: Arch Linux
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

DESCRIPTION

KRFB does not synchronize clipboard text between a VNC client and the shared
Plasma Wayland desktop, in either direction.

The VNC connection itself works correctly, including screen sharing, mouse
input, keyboard input, and Ctrl+C/Ctrl+V shortcuts. Copying and pasting between
applications within the remote Plasma session also works.

However, copying text on the VNC client does not update the clipboard on the
Plasma Wayland desktop, and copying text on Plasma does not update the VNC
client's clipboard.

This became apparent after switching from Plasma X11, where clipboard sharing
previously worked, to Plasma Wayland. It may be a pre-existing Wayland
limitation rather than a regression introduced by the latest Plasma update.

STEPS TO REPRODUCE

1. Start a KDE Plasma Wayland session on Arch Linux.
2. Start KRFB with the PipeWire framebuffer plugin
(`preferredFrameBufferPlugin=pw`) and authorize remote desktop sharing.
3. Connect to the desktop from a macOS VNC client.
4. Open Kate on the remote desktop, type `hello`, select it, and press Ctrl+C
followed by Ctrl+V. Verify that local clipboard operations work.
5. On the Mac, copy `MAC-TO-ARCH-123` to the clipboard.
6. In the remote Kate window, try pasting using Ctrl+V and also using Edit →
Paste.
7. On the remote desktop, copy `ARCH-TO-MAC-456` from Kate.
8. On the Mac, paste into a local text editor.

OBSERVED RESULT

- Copy/paste within the Plasma desktop works normally.
- Ctrl+C and Ctrl+V are correctly transmitted through VNC.
- Edit → Copy/Paste in Kate also works.
- Mac → Arch: Instead of `MAC-TO-ARCH-123`, Kate pastes the previous remote
clipboard content (`hello`).
- Arch → Mac: Instead of `ARCH-TO-MAC-456`, the Mac pastes its previous local
clipboard content (`MAC-TO-ARCH-123`).
- Screen sharing and remote keyboard/mouse control continue working.

Clipboard synchronization fails in both directions, while local clipboard
operations on each machine continue to work.

EXPECTED RESULT

Text copied to the clipboard on either the VNC client or the Plasma Wayland
desktop should become available on the other machine.

Clipboard synchronization should work in both directions, as it previously did
when using KRFB with Plasma X11.

SOFTWARE/OS VERSIONS

Operating System: Arch Linux x86_64  
Linux kernel: 7.2.11-arch1-1  
KDE Plasma Version: 6.8.1  
KDE Frameworks Version: Not yet recorded  
Qt Version: Not yet recorded  
Graphics Platform: Wayland  
KWin: 6.8.1-2  
KRFB: 26.04.3-1  
KPipeWire: 6.8.1-1  
PipeWire: 1:1.6.10-1  
libvncserver: 0.9.15-1  
VNC client OS: macOS  
VNC client application/version: Not yet recorded  

ADDITIONAL INFORMATION

KRFB 26.04.3 is currently installed because newer KRFB 26.08.x releases have a
separate VNC listener regression, tracked as bug 524610. Clipboard
synchronization has not yet been retested with KRFB 26.08.x.

A possible explanation for the server-to-client failure is visible in KRFB
26.04.3's `krfb/rfbserver.cpp`.

In `RfbServer::start()`, the clipboard-change signal is connected only when
`QX11Info::isPlatformX11()` returns true:

    if (QX11Info::isPlatformX11()) {
        connect(QApplication::clipboard(), &QClipboard::dataChanged,
                this, &RfbServer::krfbSendServerCutText);
    }

This appears to prevent outgoing clipboard-change notifications from being sent
to VNC clients when KRFB runs on Wayland.

The incoming VNC clipboard handlers also use
`QApplication::clipboard()->setText()`. Whether this correctly updates the
system clipboard when KRFB is unfocused under Wayland has not been verified.
The incoming failure could also depend on the VNC client's behavior.

Relevant source:
https://github.com/KDE/krfb/blob/v26.04.3/krfb/rfbserver.cpp

KDE's original KRFB Wayland implementation review also discussed clipboard
sharing as an unresolved issue:
https://phabricator.kde.org/D20402

KDE Frameworks provides `KSystemClipboard`, which supports clipboard access for
unfocused applications and may be relevant to a solution:
https://api.kde.org/ksystemclipboard.html

Related but different reports:

- Bug 430339: Clipboard encoding/duplicate entries when using KRDC and KRFB
(resolved).
- Bug 524610: KRFB 26.08.x does not start its VNC listener (separate issue).

It would be useful to know whether bidirectional clipboard synchronization is
expected to be supported by KRFB on Wayland, and whether the current clipboard
implementation could be adapted to support it.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to