Commit e757276f authored by Devin Lin's avatar Devin Lin 🎨
Browse files

lookandfeel: Add support for no window decorations

parent bbb76244
Pipeline #201264 passed with stage
in 8 minutes and 22 seconds
......@@ -286,7 +286,7 @@ void KCMLookandFeel::addKPackageToModel(const KPackage::Package &pkg)
cg = KConfigGroup(conf, "kwinrc");
cg = KConfigGroup(&cg, "org.kde.kdecoration2");
row->setData(!cg.readEntry("library", QString()).isEmpty(), HasWindowDecorationRole);
row->setData(!cg.readEntry("library", QString()).isEmpty() || !cg.readEntry("NoPlugin", QString()).isEmpty(), HasWindowDecorationRole);
cg = KConfigGroup(conf, "kdeglobals");
KConfigGroup cg2(&cg, "WM"); //for checking activeFont
......@@ -417,12 +417,12 @@ void KCMLookandFeel::resetLayoutToApply()
return;
}
constexpr std::array layoutPairs {
constexpr std::array layoutPairs{
std::make_pair(LookAndFeelManager::DesktopLayout, HasDesktopLayoutRole),
std::make_pair(LookAndFeelManager::WindowPlacement, HasDesktopLayoutRole),
std::make_pair(LookAndFeelManager::ShellPackage, HasDesktopLayoutRole),
std::make_pair(LookAndFeelManager::DesktopSwitcher, HasDesktopLayoutRole),
}; //NOTE: Items that have their own Has...Role instead will be added soon
}; // NOTE: Items that have their own Has...Role instead will be added soon
for (const auto &pair : layoutPairs) {
applyFlags.setFlag(pair.first, m_model->data(m_model->index(index, 0), pair.second).toBool());
}
......
......@@ -136,7 +136,7 @@ void LookAndFeelManager::setShellPackage(const QString &value)
m_plasmashellChanged = true;
}
void LookAndFeelManager::setWindowDecoration(const QString &library, const QString &theme)
void LookAndFeelManager::setWindowDecoration(const QString &library, const QString &theme, bool noPlugin)
{
if (library.isEmpty()) {
return;
......@@ -149,6 +149,7 @@ void LookAndFeelManager::setWindowDecoration(const QString &library, const QStri
KConfigGroup defaultGroup(&configDefault, QStringLiteral("org.kde.kdecoration2"));
writeNewDefaults(group, defaultGroup, QStringLiteral("library"), library);
writeNewDefaults(group, defaultGroup, QStringLiteral("theme"), theme, KConfig::Notify);
writeNewDefaults(group, defaultGroup, QStringLiteral("NoPlugin"), noPlugin ? "true" : "false", KConfig::Notify);
}
void LookAndFeelManager::setWidgetStyle(const QString &style)
......@@ -455,11 +456,15 @@ void LookAndFeelManager::save(const KPackage::Package &package, const KPackage::
if (m_appearanceToApply.testFlag(LookAndFeelManager::WindowDecoration)) {
group = KConfigGroup(conf, "kwinrc");
group = KConfigGroup(&group, "org.kde.kdecoration2");
#ifdef HAVE_BREEZE_DECO
setWindowDecoration(group.readEntry("library", QStringLiteral(BREEZE_KDECORATION_PLUGIN_ID)), group.readEntry("theme", QStringLiteral("Breeze")));
setWindowDecoration(group.readEntry("library", QStringLiteral(BREEZE_KDECORATION_PLUGIN_ID)),
group.readEntry("theme", QStringLiteral("Breeze")),
group.readEntry("NoPlugin", false));
#else
setWindowDecoration(group.readEntry("library", QStringLiteral("org.kde.kwin.aurorae")),
group.readEntry("theme", QStringLiteral("kwin4_decoration_qml_plastik")));
group.readEntry("theme", QStringLiteral("kwin4_decoration_qml_plastik")),
group.readEntry("NoPlugin", false));
#endif
}
......
......@@ -49,10 +49,10 @@ public:
enum LayoutToApplyFlags {
DesktopLayout = 1 << 0,
WindowPlacement = 1 << 1, //FIXME: Do we still want these three?
WindowPlacement = 1 << 1, // FIXME: Do we still want these three?
ShellPackage = 1 << 2,
DesktopSwitcher = 1 << 3,
LayoutSettings = (1<< 4) -1, //NOTE: This will be used once TitlebarLayout, etc. is added, it's just here for now
LayoutSettings = (1 << 4) - 1, // NOTE: This will be used once TitlebarLayout, etc. is added, it's just here for now
// to simplify lnftool and lookandfeelmanager
};
Q_DECLARE_FLAGS(LayoutToApply, LayoutToApplyFlags)
......@@ -85,7 +85,7 @@ public:
void setLockScreen(const QString &theme);
void setWindowSwitcher(const QString &theme);
void setDesktopSwitcher(const QString &theme);
void setWindowDecoration(const QString &library, const QString &theme);
void setWindowDecoration(const QString &library, const QString &theme, bool noPlugin);
void setWindowPlacement(const QString &value);
void setShellPackage(const QString &name);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment