fix: use wl-copy for clipboard writes on native Wayland sessions#12536
Open
jb0421 wants to merge 2 commits intoowncloud:6from
Open
fix: use wl-copy for clipboard writes on native Wayland sessions#12536jb0421 wants to merge 2 commits intoowncloud:6from
jb0421 wants to merge 2 commits intoowncloud:6from
Conversation
On Wayland the ownCloud daemon has no compositor surface and never receives keyboard focus, so QClipboard::setText() is silently dropped by the compositor when COPY_PRIVATE_LINK is handled. Detect a native Wayland session via WAYLAND_DISPLAY and delegate the clipboard write to wl-copy(1), which does not require a compositor surface. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
Member
|
Interesting approach indeed ..... requires wl-copy to be installed .... also needs to be ltested with the appimage - I guess we would need wl-copy to be packaged into the app image ... |
Author
|
@DeepDiver1975 Should I create a new PR with |
Member
feel free to give it a shot - thank you |
5d10c84 to
4e5e57e
Compare
On Wayland, look for wl-copy next to the application binary first (covers self-contained builds like AppImage), then fall back to PATH. Add BUNDLE_WL_COPY cmake option to install wl-copy alongside the client binary during packaging. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4e5e57e to
b99fc81
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #12534
On native Wayland sessions,
QApplication::clipboard()->setText()is silentlydropped by the compositor when the ownCloud daemon has no focused surface — which
is always the case when the command arrives via the socket from a file manager
shell integration.
This change detects a native Wayland session via
WAYLAND_DISPLAYand delegatesthe clipboard write to
wl-copy(1), which uses the Wayland primary selectionprotocol and does not require a compositor surface.
Changes
copyUrlToClipboard(): fall back towl-copywhenWAYLAND_DISPLAYis set#include <QProcess>Testing
Tested manually on Ubuntu 24.04 LTS (GNOME Wayland, Nautilus 46.4) with a locally
built client:
Notes
wl-copyis provided by thewl-clipboardpackage, which is available on allmajor Linux distributions and is a common dependency for Wayland clipboard tools.
If
wl-copyis not installed,QProcess::startDetachedsilently fails and theclipboard write is lost — same behaviour as before this fix.
See also: owncloud/client-desktop-shell-integration-nautilus#11 (comment)