feat: Settings expose settings to use wl-clipboard backend. Disable clipboard on wayland if this settings is disabled

This commit is contained in:
sithlord48 2025-11-16 08:08:28 -05:00 committed by Chris Rizzitello
parent 90e7d475f8
commit d157713a85
11 changed files with 93 additions and 11 deletions

View file

@ -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

View file

@ -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<Settings::ProcessMode>();
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);

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>549</width>
<height>628</height>
<height>755</height>
</rect>
</property>
<property name="windowTitle">
@ -661,6 +661,35 @@
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widgetWlClipboard" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QCheckBox" name="cbUseWlClipboard">
<property name="text">
<string>Enable wl-clipboard support</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblWlClipboard">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Requires the wl-clipboard package&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
@ -674,11 +703,6 @@
</property>
</spacer>
</item>
<item>
<widget class="QWidget" name="widgetLangControls" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2"/>
</widget>
</item>
</layout>
</widget>
</widget>

View file

@ -9,6 +9,7 @@
#include "base/Log.h"
#include <chrono>
#include <common/Settings.h>
#include <cstdlib>
#include <cstring>
#include <errno.h>
@ -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) {

View file

@ -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();

View file

@ -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;

View file

@ -1248,6 +1248,14 @@ Al habilitar esta opción, se deshabilitará la interfaz gráfica de usuario (GU
<source>Enable GUI debug messages</source>
<translation type="unfinished">Habilitar mensajes de depuración de la interfaz gráfica de usuario</translation>
</message>
<message>
<source>Enable wl-clipboard support</source>
<translation type="unfinished">Habilitar la compatibilidad con wl-clipboard</translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Requires the wl-clipboard package&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Requiere el paquete wl-clipboard&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
</context>
<context>
<name>TlsCertificate</name>

View file

@ -1248,6 +1248,14 @@ L&apos;abilitazione di questa impostazione disabiliterà l&apos;interfaccia graf
<source>Enable GUI debug messages</source>
<translation>Abilita i messaggi di debug della GUI</translation>
</message>
<message>
<source>Enable wl-clipboard support</source>
<translation>Abilita il supporto wl-clipboard</translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Requires the wl-clipboard package&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Richiede il pacchetto wl-clipboard&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
</context>
<context>
<name>TlsCertificate</name>

View file

@ -1249,6 +1249,14 @@ Enabling this setting will disable the server config GUI.</source>
<source>Verbose debug output</source>
<translation>詳細なデバッグ出力</translation>
</message>
<message>
<source>Enable wl-clipboard support</source>
<translation>wl-clipboard によるクリップボード対応を有効にする</translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Requires the wl-clipboard package&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;wl-clipboard パッケージが必要です。&lt;/p&gt;&lt;p&gt;wl-clipboard v2.2.1 を使用すると、フォーカス盗用のバグにより Deskflow の使い勝手が悪くなる可能性があります。この問題は wl-clipboard のマスターブランチで修正されていますが、使用しているコンポジターが wlroots-data-control プロトコルに対応している必要があります。&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
</context>
<context>
<name>TlsCertificate</name>

View file

@ -1209,10 +1209,6 @@ Enabling this setting will disable the server config GUI.</source>
<source>Enable wl-clipboard support</source>
<translation>Врубить поддержку буфера обмена</translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Requires the wl-clipboard package.&lt;/p&gt;&lt;p&gt;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&apos;s master branch.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Дляя этого нужен пакет wl-clipboard.&lt;/p&gt;&lt;p&gt;Когда ты используешь wl-clipboard v2.2.1. Возникает ошибка перехвата фокуса, которая мешает использовать deskflowю. Это фиксется если использовать wl-clipboard из ветки master .&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<source>TLS Certificate Regenerated</source>
<translation>Перегенерировать TLS Сертификат</translation>
@ -1261,6 +1257,10 @@ Enabling this setting will disable the server config GUI.</source>
<source>Verbose debug output</source>
<translation>Подробный отладочный вывод</translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Requires the wl-clipboard package&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Для этого необходим пакет wl-clipboard.&lt;/p&gt;&lt;p&gt;Когда ты используешь wl-clipboard v2.2.1. Возникает ошибка перехвата фокуса, которая мешает использовать deskflowю. Это фиксется если использовать wl-clipboard из ветки master, если только ваш Compositor не поддерживает протокол wlroots-data-control.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
</context>
<context>
<name>TlsCertificate</name>

View file

@ -1249,6 +1249,14 @@ Enabling this setting will disable the server config GUI.</source>
<source>Verbose debug output</source>
<translation>详细调试输出</translation>
</message>
<message>
<source>Enable wl-clipboard support</source>
<translation>启用 wl-clipboard 支持</translation>
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Requires the wl-clipboard package&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;需要 wl-clipboard 包&lt;/p&gt;&lt;p&gt;使用 wl-clipboard v2.2.1 时存在一个焦点抢夺 Bug,可能导致 Deskflow 使用不便。该问题已在 wl-clipboard 的 master 分支中修复,除非您的合成器不支持 wlroots-data-control 协议。&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
</context>
<context>
<name>TlsCertificate</name>