From d157713a85d4d6ce0b8e622d7f9509f9585663cb Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Sun, 16 Nov 2025 08:08:28 -0500 Subject: [PATCH] feat: Settings expose settings to use wl-clipboard backend. Disable clipboard on wayland if this settings is disabled --- src/lib/common/Settings.h | 3 ++ src/lib/gui/dialogs/SettingsDialog.cpp | 10 ++++++ src/lib/gui/dialogs/SettingsDialog.ui | 36 ++++++++++++++++++---- src/lib/platform/WlClipboard.cpp | 6 ++++ src/lib/platform/WlClipboard.h | 3 ++ src/lib/platform/WlClipboardCollection.cpp | 6 +++- translations/deskflow_es.ts | 8 +++++ translations/deskflow_it.ts | 8 +++++ translations/deskflow_ja.ts | 8 +++++ translations/deskflow_ru.ts | 8 ++--- translations/deskflow_zh_CN.ts | 8 +++++ 11 files changed, 93 insertions(+), 11 deletions(-) diff --git a/src/lib/common/Settings.h b/src/lib/common/Settings.h index 975954ee6..c7648731c 100644 --- a/src/lib/common/Settings.h +++ b/src/lib/common/Settings.h @@ -54,6 +54,7 @@ public: inline static const auto Display = QStringLiteral("core/display"); inline static const auto UseHooks = QStringLiteral("core/useHooks"); inline static const auto Language = QStringLiteral("core/language"); + inline static const auto useWlClipboard = QStringLiteral("core/wlClipboard"); }; struct Daemon { @@ -194,6 +195,7 @@ private: , Settings::Core::UpdateUrl , Settings::Core::Display , Settings::Core::UseHooks + , Settings::Core::useWlClipboard , Settings::Core::Language , Settings::Daemon::Command , Settings::Daemon::Elevate @@ -223,6 +225,7 @@ private: Settings::Gui::Autohide , Settings::Core::StartedBefore , Settings::Core::PreventSleep + , Settings::Core::useWlClipboard , Settings::Server::ExternalConfig , Settings::Client::InvertScrollDirection , Settings::Log::ToFile diff --git a/src/lib/gui/dialogs/SettingsDialog.cpp b/src/lib/gui/dialogs/SettingsDialog.cpp index a8cb578db..3203030c8 100644 --- a/src/lib/gui/dialogs/SettingsDialog.cpp +++ b/src/lib/gui/dialogs/SettingsDialog.cpp @@ -178,6 +178,7 @@ void SettingsDialog::accept() Settings::setValue(Settings::Client::ScrollSpeed, ui->sbScrollSpeed->value()); Settings::setValue(Settings::Core::Language, ui->comboLanguage->currentText()); Settings::setValue(Settings::Log::GuiDebug, ui->cbGuiDebug->isChecked()); + Settings::setValue(Settings::Core::useWlClipboard, ui->cbUseWlClipboard->isChecked()); Settings::ProcessMode mode; if (ui->groupService->isChecked()) @@ -205,6 +206,7 @@ void SettingsDialog::loadFromConfig() ui->cbAutoUpdate->setChecked(Settings::value(Settings::Gui::AutoUpdateCheck).toBool()); ui->sbScrollSpeed->setValue(Settings::value(Settings::Client::ScrollSpeed).toInt()); ui->cbGuiDebug->setChecked(Settings::value(Settings::Log::GuiDebug).toBool()); + ui->cbUseWlClipboard->setChecked(Settings::value(Settings::Core::useWlClipboard).toBool()); const auto processMode = Settings::value(Settings::Core::ProcessMode).value(); ui->groupService->setChecked(processMode == Settings::ProcessMode::Service); @@ -308,6 +310,14 @@ void SettingsDialog::updateControls() ui->groupService->setVisible(false); } + // wl-clipboard support only works on wayland. + // options should only be available when we are *not* running on wayland. + if (deskflow::platform::isWayland()) { + ui->cbUseWlClipboard->setEnabled(writable); + } else if (ui->widgetWlClipboard->isVisibleTo(ui->tabAdvanced)) { + ui->widgetWlClipboard->setVisible(false); + } + ui->groupClientOptions->setEnabled(writable && isClientMode()); ui->widgetLogFilename->setEnabled(writable && logToFile); diff --git a/src/lib/gui/dialogs/SettingsDialog.ui b/src/lib/gui/dialogs/SettingsDialog.ui index d4ea34fd9..8bce0d9a4 100644 --- a/src/lib/gui/dialogs/SettingsDialog.ui +++ b/src/lib/gui/dialogs/SettingsDialog.ui @@ -7,7 +7,7 @@ 0 0 549 - 628 + 755 @@ -661,6 +661,35 @@ + + + + + 0 + 0 + + + + + + + Enable wl-clipboard support + + + + + + + <html><head/><body><p>Requires the wl-clipboard package</p><p>When using wl-clipboard v2.2.1, there is a focus stealing bug that may make Deskflow harder to use. This has been fixed when using the wl-clipboard master branch, unless your Compositor lacks wlroots-data-control protocol support.</p></body></html> + + + true + + + + + + @@ -674,11 +703,6 @@ - - - - - diff --git a/src/lib/platform/WlClipboard.cpp b/src/lib/platform/WlClipboard.cpp index 5f9cea9a7..750d234f8 100644 --- a/src/lib/platform/WlClipboard.cpp +++ b/src/lib/platform/WlClipboard.cpp @@ -9,6 +9,7 @@ #include "base/Log.h" #include +#include #include #include #include @@ -211,6 +212,11 @@ bool WlClipboard::checkCommandExists(const char *command) } } +bool WlClipboard::isEnabled() +{ + return Settings::value(Settings::Core::useWlClipboard).toBool(); +} + void WlClipboard::startMonitoring() { if (m_monitoring) { diff --git a/src/lib/platform/WlClipboard.h b/src/lib/platform/WlClipboard.h index ac2888c45..7a510684e 100644 --- a/src/lib/platform/WlClipboard.h +++ b/src/lib/platform/WlClipboard.h @@ -39,6 +39,9 @@ public: //! Check if wl-clipboard tools are available static bool isAvailable(); + //! Check if WlClipboard is enabled + static bool isEnabled(); + //! Start monitoring clipboard changes void startMonitoring(); diff --git a/src/lib/platform/WlClipboardCollection.cpp b/src/lib/platform/WlClipboardCollection.cpp index d910cb927..2faedd031 100644 --- a/src/lib/platform/WlClipboardCollection.cpp +++ b/src/lib/platform/WlClipboardCollection.cpp @@ -95,7 +95,11 @@ void WlClipboardCollection::resetChanged() const void WlClipboardCollection::initialize() { - // Check if Wayland clipboard is available + if (!WlClipboard::isEnabled()) { + LOG_DEBUG("wl-clipboard setting disabled"); + return; + } + if (!WlClipboard::isAvailable()) { LOG_WARN("wl-clipboard tools not found, clipboard functionality disabled"); return; diff --git a/translations/deskflow_es.ts b/translations/deskflow_es.ts index 61bf1cc29..4682fb7b7 100644 --- a/translations/deskflow_es.ts +++ b/translations/deskflow_es.ts @@ -1248,6 +1248,14 @@ Al habilitar esta opción, se deshabilitará la interfaz gráfica de usuario (GU Enable GUI debug messages Habilitar mensajes de depuración de la interfaz gráfica de usuario + + Enable wl-clipboard support + Habilitar la compatibilidad con wl-clipboard + + + <html><head/><body><p>Requires the wl-clipboard package</p><p>When using wl-clipboard v2.2.1, there is a focus stealing bug that may make Deskflow harder to use. This has been fixed when using the wl-clipboard master branch, unless your Compositor lacks wlroots-data-control protocol support.</p></body></html> + <html><head/><body><p>Requiere el paquete wl-clipboard</p><p>Al usar wl-clipboard v2.2.1, existe un error que provoca la pérdida del foco y que puede dificultar el uso de Deskflow. Este error se ha corregido al usar la rama principal de wl-clipboard, a menos que su Compositor no sea compatible con el protocolo wlroots-data-control.</p></body></html> + TlsCertificate diff --git a/translations/deskflow_it.ts b/translations/deskflow_it.ts index 95f69f566..66c6004ad 100644 --- a/translations/deskflow_it.ts +++ b/translations/deskflow_it.ts @@ -1248,6 +1248,14 @@ L'abilitazione di questa impostazione disabiliterà l'interfaccia graf Enable GUI debug messages Abilita i messaggi di debug della GUI + + Enable wl-clipboard support + Abilita il supporto wl-clipboard + + + <html><head/><body><p>Requires the wl-clipboard package</p><p>When using wl-clipboard v2.2.1, there is a focus stealing bug that may make Deskflow harder to use. This has been fixed when using the wl-clipboard master branch, unless your Compositor lacks wlroots-data-control protocol support.</p></body></html> + <html><head/><body><p>Richiede il pacchetto wl-clipboard</p><p>Quando si utilizza wl-clipboard v2.2.1, si verifica un bug di furto del focus che potrebbe rendere Deskflow più difficile da usare. Questo problema è stato risolto quando si utilizza il ramo master di wl-clipboard, a meno che il proprio compositore non supporti il ​​protocollo wlroots-data-control.</p></body></html> + TlsCertificate diff --git a/translations/deskflow_ja.ts b/translations/deskflow_ja.ts index 9dfd57107..7fc0574b7 100644 --- a/translations/deskflow_ja.ts +++ b/translations/deskflow_ja.ts @@ -1249,6 +1249,14 @@ Enabling this setting will disable the server config GUI. Verbose debug output 詳細なデバッグ出力 + + Enable wl-clipboard support + wl-clipboard によるクリップボード対応を有効にする + + + <html><head/><body><p>Requires the wl-clipboard package</p><p>When using wl-clipboard v2.2.1, there is a focus stealing bug that may make Deskflow harder to use. This has been fixed when using the wl-clipboard master branch, unless your Compositor lacks wlroots-data-control protocol support.</p></body></html> + <html><head/><body><p>wl-clipboard パッケージが必要です。</p><p>wl-clipboard v2.2.1 を使用すると、フォーカス盗用のバグにより Deskflow の使い勝手が悪くなる可能性があります。この問題は wl-clipboard のマスターブランチで修正されていますが、使用しているコンポジターが wlroots-data-control プロトコルに対応している必要があります。</p></body></html> + TlsCertificate diff --git a/translations/deskflow_ru.ts b/translations/deskflow_ru.ts index a813cc5cc..544ea20f8 100644 --- a/translations/deskflow_ru.ts +++ b/translations/deskflow_ru.ts @@ -1209,10 +1209,6 @@ Enabling this setting will disable the server config GUI. Enable wl-clipboard support Врубить поддержку буфера обмена - - <html><head/><body><p>Requires the wl-clipboard package.</p><p>When using wl-clipboard v2.2.1. There is a focus stealing bug that may make deskflow harder to use. This has been fixed when using wl-clipboard's master branch.</p></body></html> - <html><head/><body><p>Дляя этого нужен пакет wl-clipboard.</p><p>Когда ты используешь wl-clipboard v2.2.1. Возникает ошибка перехвата фокуса, которая мешает использовать deskflowю. Это фиксется если использовать wl-clipboard из ветки master .</p></body></html> - TLS Certificate Regenerated Перегенерировать TLS Сертификат @@ -1261,6 +1257,10 @@ Enabling this setting will disable the server config GUI. Verbose debug output Подробный отладочный вывод + + <html><head/><body><p>Requires the wl-clipboard package</p><p>When using wl-clipboard v2.2.1, there is a focus stealing bug that may make Deskflow harder to use. This has been fixed when using the wl-clipboard master branch, unless your Compositor lacks wlroots-data-control protocol support.</p></body></html> + <html><head/><body><p>Для этого необходим пакет wl-clipboard.</p><p>Когда ты используешь wl-clipboard v2.2.1. Возникает ошибка перехвата фокуса, которая мешает использовать deskflowю. Это фиксется если использовать wl-clipboard из ветки master, если только ваш Compositor не поддерживает протокол wlroots-data-control.</p></body></html> + TlsCertificate diff --git a/translations/deskflow_zh_CN.ts b/translations/deskflow_zh_CN.ts index 60bdd3f63..9d7362ee4 100644 --- a/translations/deskflow_zh_CN.ts +++ b/translations/deskflow_zh_CN.ts @@ -1249,6 +1249,14 @@ Enabling this setting will disable the server config GUI. Verbose debug output 详细调试输出 + + Enable wl-clipboard support + 启用 wl-clipboard 支持 + + + <html><head/><body><p>Requires the wl-clipboard package</p><p>When using wl-clipboard v2.2.1, there is a focus stealing bug that may make Deskflow harder to use. This has been fixed when using the wl-clipboard master branch, unless your Compositor lacks wlroots-data-control protocol support.</p></body></html> + <html><head/><body><p>需要 wl-clipboard 包</p><p>使用 wl-clipboard v2.2.1 时存在一个焦点抢夺 Bug,可能导致 Deskflow 使用不便。该问题已在 wl-clipboard 的 master 分支中修复,除非您的合成器不支持 wlroots-data-control 协议。</p></body></html> + TlsCertificate