From 6be66ed8f95d6ab7b0de73e8e5fd948d91142744 Mon Sep 17 00:00:00 2001 From: wheaney <42350981+wheaney@users.noreply.github.com> Date: Tue, 9 Sep 2025 21:40:19 -0700 Subject: [PATCH] Attempt to unload the KWin plugin at the start of uninstall to prevent crashes --- kwin/bin/breezy_kwin_uninstall | 12 ++++++++++++ kwin/src/breezydesktopeffect.cpp | 10 +++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/kwin/bin/breezy_kwin_uninstall b/kwin/bin/breezy_kwin_uninstall index 82f9c49..8f620b2 100755 --- a/kwin/bin/breezy_kwin_uninstall +++ b/kwin/bin/breezy_kwin_uninstall @@ -8,6 +8,18 @@ fi # we don't want the uninstall script to be able to cause a failure if being triggered by the setup script [ "$for_install" -eq 0 ] && set -e +if command -v qdbus >/dev/null 2>&1; then + QDBUS_CMD=$(command -v qdbus) +elif command -v qdbus6 >/dev/null 2>&1; then + QDBUS_CMD=$(command -v qdbus6) +fi + +if [ -n "$QDBUS_CMD" ]; then + if $QDBUS_CMD org.kde.KWin /Effects org.kde.kwin.Effects.unloadEffect breezy_desktop; then + [ "$for_install" -eq 0 ] && echo "Unloaded breezy_desktop effect" + fi +fi + USER_HOME=$(realpath ~) if [ "$for_install" -eq 0 ]; then UA_EVENT_NAME="breezy_kwin_uninstall" diff --git a/kwin/src/breezydesktopeffect.cpp b/kwin/src/breezydesktopeffect.cpp index 278f15e..0807139 100644 --- a/kwin/src/breezydesktopeffect.cpp +++ b/kwin/src/breezydesktopeffect.cpp @@ -273,11 +273,11 @@ void BreezyDesktopEffect::deactivate() void BreezyDesktopEffect::enableDriver() { qCCritical(KWIN_XR) << "\t\t\tBreezy - enableDriver"; - QJsonObject obj; - obj.insert(QStringLiteral("disabled"), false); - obj.insert(QStringLiteral("output_mode"), QStringLiteral("external_only")); - obj.insert(QStringLiteral("external_mode"), QStringLiteral("breezy_desktop")); - XRDriverIPC::instance().writeConfig(obj); + QJsonObject obj; + obj.insert(QStringLiteral("disabled"), false); + obj.insert(QStringLiteral("output_mode"), QStringLiteral("external_only")); + obj.insert(QStringLiteral("external_mode"), QStringLiteral("breezy_desktop")); + XRDriverIPC::instance().writeConfig(obj); } void BreezyDesktopEffect::disableDriver()