Skip to content

Commit b99fc81

Browse files
jb0421claude
andcommitted
feat: prefer bundled wl-copy and add BUNDLE_WL_COPY cmake option
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>
1 parent d1c7b3e commit b99fc81

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/gui/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,4 +230,10 @@ if(UNIX AND NOT APPLE)
230230
if(SharedMimeInfo_FOUND)
231231
update_xdg_mimetypes( ${KDE_INSTALL_DATADIR}/mime/packages )
232232
endif(SharedMimeInfo_FOUND)
233+
234+
option(BUNDLE_WL_COPY "Bundle wl-copy for self-contained builds such as AppImage" OFF)
235+
if(BUNDLE_WL_COPY)
236+
find_program(WL_COPY_EXECUTABLE wl-copy REQUIRED)
237+
install(PROGRAMS ${WL_COPY_EXECUTABLE} DESTINATION ${KDE_INSTALL_BINDIR})
238+
endif()
233239
endif()

src/gui/socketapi/socketapi.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include <QDir>
3939
#include <QFile>
4040
#include <QFileDialog>
41+
#include <QFileInfo>
4142
#include <QLocalSocket>
4243
#include <QMessageBox>
4344
#include <QMetaMethod>
@@ -674,7 +675,11 @@ void SocketApi::command_OPEN_PRIVATE_LINK_VERSIONS(const QString &localFile, Soc
674675
void SocketApi::copyUrlToClipboard(const QUrl &link)
675676
{
676677
if (!qgetenv("WAYLAND_DISPLAY").isEmpty()) {
677-
QProcess::startDetached(QStringLiteral("wl-copy"), {link.toString()});
678+
QString wlCopy = QApplication::applicationDirPath() + QStringLiteral("/wl-copy");
679+
if (!QFileInfo::exists(wlCopy)) {
680+
wlCopy = QStringLiteral("wl-copy");
681+
}
682+
QProcess::startDetached(wlCopy, {link.toString()});
678683
} else {
679684
QApplication::clipboard()->setText(link.toString());
680685
}

0 commit comments

Comments
 (0)