diff --git a/changelog/unreleased/12534.md b/changelog/unreleased/12534.md new file mode 100644 index 00000000000..e57ec99d596 --- /dev/null +++ b/changelog/unreleased/12534.md @@ -0,0 +1,8 @@ +Bugfix: Fix "Copy private link to clipboard" on native Wayland sessions + +The "Copy private link to clipboard" action now correctly writes to the +clipboard on native Wayland sessions. Previously the write was silently +dropped by the Wayland compositor because the ownCloud daemon has no +compositor surface. + +https://github.com/owncloud/client/issues/12534 diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index a51e69a6193..273950295dc 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -230,4 +230,10 @@ if(UNIX AND NOT APPLE) if(SharedMimeInfo_FOUND) update_xdg_mimetypes( ${KDE_INSTALL_DATADIR}/mime/packages ) endif(SharedMimeInfo_FOUND) + + option(BUNDLE_WL_COPY "Bundle wl-copy for self-contained builds such as AppImage" OFF) + if(BUNDLE_WL_COPY) + find_program(WL_COPY_EXECUTABLE wl-copy REQUIRED) + install(PROGRAMS ${WL_COPY_EXECUTABLE} DESTINATION ${KDE_INSTALL_BINDIR}) + endif() endif() diff --git a/src/gui/socketapi/socketapi.cpp b/src/gui/socketapi/socketapi.cpp index 23b888b62d3..ad06142adc9 100644 --- a/src/gui/socketapi/socketapi.cpp +++ b/src/gui/socketapi/socketapi.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -54,6 +55,7 @@ #include #include +#include #ifdef Q_OS_MAC #include @@ -672,7 +674,15 @@ void SocketApi::command_OPEN_PRIVATE_LINK_VERSIONS(const QString &localFile, Soc void SocketApi::copyUrlToClipboard(const QUrl &link) { - QApplication::clipboard()->setText(link.toString()); + if (!qgetenv("WAYLAND_DISPLAY").isEmpty()) { + QString wlCopy = QApplication::applicationDirPath() + QStringLiteral("/wl-copy"); + if (!QFileInfo::exists(wlCopy)) { + wlCopy = QStringLiteral("wl-copy"); + } + QProcess::startDetached(wlCopy, {link.toString()}); + } else { + QApplication::clipboard()->setText(link.toString()); + } } void SocketApi::command_MAKE_AVAILABLE_LOCALLY(const QString &filesArg, SocketListener *)