diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,6 +125,20 @@ ) endif() +find_package(Breeze ${PROJECT_VERSION} CONFIG) +set_package_properties(Breeze PROPERTIES + TYPE OPTIONAL + PURPOSE "For setting the default window decoration plugin") +if(${Breeze_FOUND}) + if(${BREEZE_WITH_KDECORATION}) + set(HAVE_BREEZE_DECO true) + else() + set(HAVE_BREEZE_DECO FALSE) + endif() +else() + set(HAVE_BREEZE_DECO FALSE) +endif() + include_directories("${CMAKE_CURRENT_BINARY_DIR}") configure_file(config-workspace.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-workspace.h) diff --git a/config-workspace.h.cmake b/config-workspace.h.cmake --- a/config-workspace.h.cmake +++ b/config-workspace.h.cmake @@ -149,6 +149,13 @@ /* Number of bits in a file offset, on hosts where this is settable. */ #define _FILE_OFFSET_BITS 64 +/* Define 1 if the Breeze window decoration was found */ +#cmakedefine HAVE_BREEZE_DECO 1 + +#if HAVE_BREEZE_DECO +#define BREEZE_KDECORATION_PLUGIN_ID "${BREEZE_KDECORATION_PLUGIN_ID}" +#endif + /* * On HP-UX, the declaration of vsnprintf() is needed every time ! */ 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 @@ -21,6 +21,7 @@ #include "../krdb/krdb.h" #include "../cursortheme/xcursor/xcursortheme.h" #include "config-kcm.h" +#include "config-workspace.h" #include #include @@ -68,6 +69,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 +331,24 @@ cg = KConfigGroup(&cg, "DesktopSwitcher"); setDesktopSwitcher(cg.readEntry("LayoutName", QString())); } + + if (m_applyWindowDecoration) { + cg = KConfigGroup(conf, "kwinrc"); + cg = KConfigGroup(&cg, "org.kde.kdecoration2"); +#if HAVE_BREEZE_DECO + setWindowDecoration(cg.readEntry("library", QStringLiteral(BREEZE_KDECORATION_PLUGIN_ID)), cg.readEntry("theme", QString())); +#else + setWindowDecoration(cg.readEntry("library", QStringLiteral("org.kde.kwin.aurorae")), cg.readEntry("theme", QString())); +#endif + } + + // Reload KWin if something changed, but only once. + if (m_applyWindowSwitcher || 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 +615,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 +628,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) {