From 5623fe1126c9a18e6bd8e7cc6ac915a75c1d16bf Mon Sep 17 00:00:00 2001 From: wheaney <42350981+wheaney@users.noreply.github.com> Date: Sun, 14 Sep 2025 12:47:48 -0700 Subject: [PATCH] Update KCM app to be aware of whether the effect is loaded, message appropriately Improve device status checking state --- README.md | 2 +- kwin/src/kcm/breezydesktopeffectkcm.cpp | 29 ++++++++++++++++++++++--- kwin/src/kcm/breezydesktopeffectkcm.h | 2 ++ kwin/src/kcm/breezydesktopeffectkcm.ui | 6 ++--- 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d918efc..6fcdfb5 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ There are two installations available. **Note: Don't manually install either of ## Breezy Desktop -Breezy Desktop is a virtual workspace solution for Linux desktops that use the KDE Plasma 6 or GNOME desktop environments (GNOME versions 42 through 48). It supports launching multiple virtual monitors alongside multiple physical monitors. For Linux users not running GNOME or KDE, you can play around with a [nested GNOME setup](#nested-gnome-setup). +Breezy Desktop is a virtual workspace solution for Linux desktops that use the KDE Plasma 6 or GNOME desktop environments (versions 42 through 48). It supports launching multiple virtual monitors alongside multiple physical monitors. For Linux users not running GNOME or KDE, you can play around with a [nested GNOME setup](#nested-gnome-setup). For the best performance, ensure you have the latest graphics drivers installed for your distro. diff --git a/kwin/src/kcm/breezydesktopeffectkcm.cpp b/kwin/src/kcm/breezydesktopeffectkcm.cpp index 5d48cc1..2e4c2fb 100644 --- a/kwin/src/kcm/breezydesktopeffectkcm.cpp +++ b/kwin/src/kcm/breezydesktopeffectkcm.cpp @@ -34,6 +34,7 @@ #include #include #include +#include Q_LOGGING_CATEGORY(KWIN_XR, "kwin.xr") @@ -56,6 +57,9 @@ BreezyDesktopEffectConfig::BreezyDesktopEffectConfig(QObject *parent, const KPlu ui.setupUi(widget()); addConfig(BreezyDesktopConfig::self(), widget()); + // One-time check if the KWin effect backend is actually loaded. If not, disable UI early. + checkEffectLoaded(); + // Show/enable Virtual Display controls only when we're on Wayland const bool isWaylandSession = QGuiApplication::platformName().contains(QStringLiteral("wayland"), Qt::CaseInsensitive) || qEnvironmentVariable("XDG_SESSION_TYPE").compare(QStringLiteral("wayland"), Qt::CaseInsensitive) == 0; @@ -257,6 +261,23 @@ void BreezyDesktopEffectConfig::updateUnmanagedState() { } +void BreezyDesktopEffectConfig::checkEffectLoaded() { + OrgKdeKwinEffectsInterface iface(QStringLiteral("org.kde.KWin"), QStringLiteral("/Effects"), QDBusConnection::sessionBus()); + QDBusReply reply = iface.call(QStringLiteral("isEffectLoaded"), QStringLiteral("breezy_desktop")); + if (!reply.isValid() || !reply.value()) { + if (auto tabWidget = widget()->findChild()) { + tabWidget->setEnabled(false); + } + if (auto warn = widget()->findChild(QStringLiteral("labelGlobalWarning"))) { + QPalette pal = warn->palette(); + pal.setColor(QPalette::WindowText, QColor(Qt::red)); + warn->setPalette(pal); + warn->setText(tr("The Breezy Desktop KWin effect is not loaded. Please log out and back in to enable it.")); + warn->setVisible(true); + } + } +} + static QDBusInterface makeVDInterface() { return QDBusInterface( QStringLiteral("org.kde.KWin"), @@ -427,7 +448,7 @@ void BreezyDesktopEffectConfig::pollDriverState() const bool wasDeviceConnected = m_deviceConnected; m_deviceConnected = !m_connectedDeviceBrand.isEmpty() && !m_connectedDeviceModel.isEmpty(); - if (ui.labelDeviceConnectionStatus->text().isEmpty() || m_deviceConnected != wasDeviceConnected) { + if (!m_driverStateInitialized || m_deviceConnected != wasDeviceConnected) { ui.labelDeviceConnectionStatus->setText(m_deviceConnected ? QStringLiteral("%1 %2 connected").arg(m_connectedDeviceBrand, m_connectedDeviceModel) : QStringLiteral("No device connected")); @@ -439,6 +460,8 @@ void BreezyDesktopEffectConfig::pollDriverState() if (ui.EnableMultitap->isChecked() != multitap) ui.EnableMultitap->setChecked(multitap); refreshLicenseUi(stateJson); + + m_driverStateInitialized = true; } bool BreezyDesktopEffectConfig::multitapEnabled(std::optional configJsonOpt) @@ -529,7 +552,7 @@ void BreezyDesktopEffectConfig::refreshLicenseUi(const QJsonObject &rootObj) { auto labelSummary = tab->findChild("labelLicenseSummary"); if (!labelSummary) return; auto donate = tab->findChild("labelDonateLink"); - auto globalWarn = widget()->findChild("labelGlobalLicenseWarning"); + auto globalWarn = widget()->findChild("labelGlobalWarning"); QString status = tr("disabled"); QString renewalDescriptor = QStringLiteral(""); @@ -601,7 +624,7 @@ void BreezyDesktopEffectConfig::refreshLicenseUi(const QJsonObject &rootObj) { if (donate) donate->setVisible(warningState || expired); - if (globalWarn) { + if (globalWarn && !globalWarn->isVisible()) { if (warningState || expired) { globalWarn->setText(message + (expired ? tr(" — effect disabled") : QString())); globalWarn->setVisible(true); diff --git a/kwin/src/kcm/breezydesktopeffectkcm.h b/kwin/src/kcm/breezydesktopeffectkcm.h index 253a5ae..8ec8404 100644 --- a/kwin/src/kcm/breezydesktopeffectkcm.h +++ b/kwin/src/kcm/breezydesktopeffectkcm.h @@ -38,6 +38,7 @@ private: bool multitapEnabled(std::optional configJsonOpt); void pollDriverState(); void refreshLicenseUi(const QJsonObject &rootObj); + void checkEffectLoaded(); void showStatus(QLabel *label, bool success, const QString &message); void setRequestInProgress(std::initializer_list widgets, bool inProgress); bool eventFilter(QObject *watched, QEvent *event) override; @@ -52,6 +53,7 @@ private: KConfigWatcher::Ptr m_configWatcher; bool m_updatingFromConfig = false; + bool m_driverStateInitialized = false; bool m_deviceConnected = false; QString m_connectedDeviceBrand; QString m_connectedDeviceModel; diff --git a/kwin/src/kcm/breezydesktopeffectkcm.ui b/kwin/src/kcm/breezydesktopeffectkcm.ui index f6a7669..4061954 100644 --- a/kwin/src/kcm/breezydesktopeffectkcm.ui +++ b/kwin/src/kcm/breezydesktopeffectkcm.ui @@ -6,7 +6,7 @@ - + Loading, please wait... Qt::AlignHCenter|Qt::AlignVCenter @@ -21,7 +21,7 @@ - + @@ -58,7 +58,7 @@ XR Effect enabled - true + false