lookandfeel: Allow setting the kwin window placement strategy

wilder-5.24
Aleix Pol 5 years ago committed by Aleix Pol Gonzalez
parent 6e80843b7f
commit d06ab412db
  1. 17
      kcms/lookandfeel/kcm.cpp
  2. 2
      kcms/lookandfeel/kcm.h

@ -381,6 +381,12 @@ void KCMLookandFeel::save()
setDesktopSwitcher(cg.readEntry("LayoutName", QString()));
}
if (m_applyWindowPlacement) {
cg = KConfigGroup(conf, "kwinrc");
cg = KConfigGroup(&cg, "Windows");
setWindowPlacement(cg.readEntry("Placement", QStringLiteral("Smart")));
}
if (m_applyWindowDecoration) {
cg = KConfigGroup(conf, "kwinrc");
cg = KConfigGroup(&cg, "org.kde.kdecoration2");
@ -393,7 +399,7 @@ void KCMLookandFeel::save()
}
// Reload KWin if something changed, but only once.
if (m_applyWindowSwitcher || m_applyDesktopSwitcher || m_applyWindowDecoration) {
if (m_applyWindowSwitcher || m_applyDesktopSwitcher || m_applyWindowDecoration || m_applyWindowPlacement) {
QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KWin"), QStringLiteral("org.kde.KWin"), QStringLiteral("reloadConfig"));
QDBusConnection::sessionBus().send(message);
}
@ -735,6 +741,15 @@ void KCMLookandFeel::setDesktopSwitcher(const QString &theme)
writeNewDefaults(cg, cgd, QStringLiteral("DesktopListLayout"), theme);
}
void KCMLookandFeel::setWindowPlacement(const QString &value)
{
if (value.isEmpty()) {
return;
}
writeNewDefaults(QStringLiteral("kwinrc"), QStringLiteral("Windows"), QStringLiteral("Placement"), value);
}
void KCMLookandFeel::setWindowDecoration(const QString &library, const QString &theme)
{
if (library.isEmpty()) {

@ -73,6 +73,7 @@ public:
void setWindowSwitcher(const QString &theme);
void setDesktopSwitcher(const QString &theme);
void setWindowDecoration(const QString &library, const QString &theme);
void setWindowPlacement(const QString &value);
Q_INVOKABLE void knsEntryChanged(KNSCore::EntryWrapper *wrapper);
Q_INVOKABLE void reloadConfig()
@ -132,6 +133,7 @@ private:
bool m_applyCursors : 1;
bool m_applyWindowSwitcher : 1;
bool m_applyDesktopSwitcher : 1;
bool m_applyWindowPlacement : 1 = true;
bool m_resetDefaultLayout : 1;
bool m_applyWindowDecoration : 1;
};

Loading…
Cancel
Save