diff --git a/app/layout/centrallayout.cpp b/app/layout/centrallayout.cpp index 3f7435d77..6e5bdb1ec 100644 --- a/app/layout/centrallayout.cpp +++ b/app/layout/centrallayout.cpp @@ -17,6 +17,7 @@ #include "../layouts/synchronizer.h" #include "../settings/universalsettings.h" #include "../view/view.h" +#include "../wm/tracker/schemes.h" // KDE #include @@ -48,8 +49,12 @@ void CentralLayout::init() void CentralLayout::initToCorona(Latte::Corona *corona) { if (GenericLayout::initToCorona(corona)) { + onSchemeFileChanged(); + connect(this, &CentralLayout::disableBordersForMaximizedWindowsChanged, m_corona->layoutsManager()->synchronizer(), &Layouts::Synchronizer::updateKWinDisabledBorders); + + connect(this, &Layout::AbstractLayout::schemeFileChanged, this, &CentralLayout::onSchemeFileChanged); } } @@ -123,6 +128,21 @@ void CentralLayout::setActivities(QStringList activities) emit activitiesChanged(); } +Latte::WindowSystem::SchemeColors *CentralLayout::scheme() const +{ + return m_scheme; +} + +void CentralLayout::setScheme(Latte::WindowSystem::SchemeColors *_scheme) +{ + if (m_scheme == _scheme) { + return; + } + + m_scheme = _scheme; + emit schemeChanged(); +} + Data::Layout CentralLayout::data() const { Data::Layout cdata; @@ -148,6 +168,11 @@ Data::Layout CentralLayout::data() const return cdata; } +void CentralLayout::onSchemeFileChanged() +{ + setScheme(m_corona->wm()->schemesTracker()->schemeForFile(schemeFile())); +} + void CentralLayout::loadConfig() { m_disableBordersForMaximizedWindows = m_layoutGroup.readEntry("disableBordersForMaximizedWindows", false); diff --git a/app/layout/centrallayout.h b/app/layout/centrallayout.h index 1b575785d..78205792a 100644 --- a/app/layout/centrallayout.h +++ b/app/layout/centrallayout.h @@ -11,6 +11,7 @@ // local #include "genericlayout.h" #include "../data/layoutdata.h" +#include "../wm/schemecolors.h" // Qt #include @@ -34,6 +35,7 @@ namespace Latte { class CentralLayout : public Layout::GenericLayout { Q_OBJECT + Q_PROPERTY(Latte::WindowSystem::SchemeColors *scheme READ scheme NOTIFY schemeChanged) public: CentralLayout(QObject *parent, QString layoutFile, QString layoutName = QString()); @@ -59,25 +61,34 @@ public: Layout::Type type() const override; Data::Layout data() const; + Latte::WindowSystem::SchemeColors *scheme() const; + public: Q_INVOKABLE bool isCurrent() override; signals: void disableBordersForMaximizedWindowsChanged(); + void schemeChanged(); void showInMenuChanged(); private slots: void loadConfig(); void saveConfig(); + void onSchemeFileChanged(); + private: void init(); void importLocalLayout(QString file); + void setScheme(Latte::WindowSystem::SchemeColors *_scheme); + private: bool m_disableBordersForMaximizedWindows{false}; bool m_showInMenu{false}; QStringList m_activities; + + Latte::WindowSystem::SchemeColors *m_scheme{nullptr}; }; }