diff --git a/kcms/lookandfeel/kcm.h b/kcms/lookandfeel/kcm.h --- a/kcms/lookandfeel/kcm.h +++ b/kcms/lookandfeel/kcm.h @@ -87,6 +87,7 @@ void setLockScreen(const QString &theme); void setWindowSwitcher(const QString &theme); void setDesktopSwitcher(const QString &theme); + void setWindowDecoration(const QString &library, const QString &theme); void setApplyColors(bool apply); bool applyColors() const; @@ -142,6 +143,7 @@ bool m_applyWindowSwitcher : 1; bool m_applyDesktopSwitcher : 1; bool m_resetDefaultLayout : 1; + bool m_applyWindowDecoration : 1; }; #endif diff --git a/kcms/lookandfeel/kcm.cpp b/kcms/lookandfeel/kcm.cpp --- a/kcms/lookandfeel/kcm.cpp +++ b/kcms/lookandfeel/kcm.cpp @@ -68,6 +68,7 @@ , m_applyWindowSwitcher(true) , m_applyDesktopSwitcher(true) , m_resetDefaultLayout(false) + , m_applyWindowDecoration(true) { //This flag seems to be needed in order for QQuickWidget to work //see https://bugreports.qt-project.org/browse/QTBUG-40765 @@ -329,6 +330,20 @@ cg = KConfigGroup(&cg, "DesktopSwitcher"); setDesktopSwitcher(cg.readEntry("LayoutName", QString())); } + + if (m_applyWindowDecoration) { + cg = KConfigGroup(conf, "kwinrc"); + cg = KConfigGroup(&cg, "org.kde.kdecoration2"); + setWindowDecoration(cg.readEntry("library", QStringLiteral("org.kde.breeze")), cg.readEntry("theme", QString())); + } + + // Reload KWin if something changed, but only once. + if (m_applyDesktopSwitcher || m_applyWindowDecoration) { + QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KWin"), + QStringLiteral("org.kde.KWin"), + QStringLiteral("reloadConfig")); + QDBusConnection::sessionBus().send(message); + } } //TODO: option to enable/disable apply? they don't seem required by UI design @@ -595,11 +610,6 @@ KConfigGroup cg(&config, "TabBox"); cg.writeEntry("LayoutName", theme); cg.sync(); - // Reload KWin. - QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KWin"), - QStringLiteral("org.kde.KWin"), - QStringLiteral("reloadConfig")); - QDBusConnection::sessionBus().send(message); } void KCMLookandFeel::setDesktopSwitcher(const QString &theme) @@ -613,14 +623,27 @@ cg.writeEntry("DesktopLayout", theme); cg.writeEntry("DesktopListLayout", theme); cg.sync(); +} + +void KCMLookandFeel::setWindowDecoration(const QString &library, const QString &theme) +{ + if (library.isEmpty()) { + return; + } + + KConfig config(QStringLiteral("kwinrc")); + KConfigGroup cg(&config, "org.kde.kdecoration2"); + cg.writeEntry("library", library); + cg.writeEntry("theme", theme); + + cg.sync(); // Reload KWin. QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KWin"), QStringLiteral("org.kde.KWin"), QStringLiteral("reloadConfig")); QDBusConnection::sessionBus().send(message); } - void KCMLookandFeel::setApplyColors(bool apply) { if (m_applyColors == apply) {