Skip to content

feat: add GET_PRIVATE_LINK socket command for Wayland clipboard support#12535

Open
DeepDiver1975 wants to merge 5 commits intomasterfrom
fix/wayland-clipboard-get-private-link
Open

feat: add GET_PRIVATE_LINK socket command for Wayland clipboard support#12535
DeepDiver1975 wants to merge 5 commits intomasterfrom
fix/wayland-clipboard-get-private-link

Conversation

@DeepDiver1975
Copy link
Copy Markdown
Member

Problem

On native Wayland sessions the ownCloud daemon has no compositor surface.
QApplication::clipboard()->setText() requires a valid Wayland wl_data_device serial
from a recent input event, but a tray-only app (system tray via StatusNotifierItem)
never receives seat events and so never has one. The compositor silently drops the
clipboard write. Copy private link to clipboard is broken for all users on Wayland.

Qt 6.9+ added zwlr-data-control support as a partial fix (QT_WAYLAND_USE_DATA_CONTROL=1),
but it requires an environment variable and only works on KDE/wlroots compositors — not on
GNOME/Mutter, which is the primary affected environment.

Solution

Add GET_PRIVATE_LINK:<file>PRIVATE_LINK:<url> to the socket protocol. File manager
extensions that run inside processes with a real Wayland surface (Nautilus, Dolphin) can
request the URL and write to the clipboard themselves.

The command reuses fetchPrivateLinkUrlHelper() — ~7 lines of new production code.
COPY_PRIVATE_LINK is unchanged for X11 and for extensions that do not yet use the new
command.

Related

Backward compatibility

Scenario Behaviour
New client + new Nautilus/Dolphin, Wayland ✅ Fixed
New client + new Nautilus/Dolphin, X11 ✅ Unchanged
Old client + new Nautilus, Wayland Graceful: GET_PRIVATE_LINK times out (3 s), falls through to COPY_PRIVATE_LINK
New client + old Nautilus/Dolphin, Wayland Unchanged (old extension still sends COPY_PRIVATE_LINK)

@update-docs
Copy link
Copy Markdown

update-docs Bot commented May 6, 2026

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

DeepDiver1975 and others added 2 commits May 6, 2026 10:05
Sends PRIVATE_LINK:<url> back over the socket so that file manager
extensions running inside processes with a valid Wayland surface can
write to the clipboard themselves, working around the compositor serial
requirement that prevents the background daemon from doing so.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
@DeepDiver1975 DeepDiver1975 force-pushed the fix/wayland-clipboard-get-private-link branch from cff9221 to 413bd02 Compare May 6, 2026 08:06
DeepDiver1975 and others added 3 commits May 6, 2026 11:28
The test duplicated the Unix socket path logic, which broke on macOS
where socketApiSocketPath() returns an XPC-style name instead of a
filesystem path. Use the canonical helper so the test connects to the
same socket the server listens on across all platforms.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
Without OWNCLOUDGUI_EXPORT the symbol had hidden visibility and was not
exported, causing an undefined symbol linker error when SocketApiTest
tried to call it on macOS.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
The previous test used QLocalSocket to connect to the SocketApi server,
which doesn't work on macOS where the server uses an XPC-based transport
instead of a local socket file.

Replace with direct invocation of command_GET_PRIVATE_LINK via
QMetaObject::invokeMethod, capturing output in a QBuffer backed
SocketListener. This is a pure unit test of the command handler with no
dependency on the platform-specific socket transport.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant