mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-06-11 08:57:21 +00:00
Expose KWin titlebar button order to QML
Snap-assist needs the configured decoration button order to find the maximize button after users move titlebar controls between sides.
This commit is contained in:
parent
e8549f90cd
commit
ba1428851e
2 changed files with 28 additions and 0 deletions
|
|
@ -13,6 +13,7 @@ const QString CONFIG_FILE = QStringLiteral("kwinrc");
|
||||||
const QString OVERLAY_CONFIG_FILE = QStringLiteral("plasma-mobile/kwinrc");
|
const QString OVERLAY_CONFIG_FILE = QStringLiteral("plasma-mobile/kwinrc");
|
||||||
const QString WAYLAND_CONFIG_GROUP = QStringLiteral("Wayland");
|
const QString WAYLAND_CONFIG_GROUP = QStringLiteral("Wayland");
|
||||||
const QString SCREEN_EDGES_CONFIG_GROUP = QStringLiteral("ScreenEdges");
|
const QString SCREEN_EDGES_CONFIG_GROUP = QStringLiteral("ScreenEdges");
|
||||||
|
const QString DECORATION_CONFIG_GROUP = QStringLiteral("org.kde.kdecoration2");
|
||||||
|
|
||||||
KWinSettings::KWinSettings(QObject *parent)
|
KWinSettings::KWinSettings(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
|
|
@ -26,6 +27,8 @@ KWinSettings::KWinSettings(QObject *parent)
|
||||||
Q_EMIT doubleTapWakeupChanged();
|
Q_EMIT doubleTapWakeupChanged();
|
||||||
} else if (group.name() == SCREEN_EDGES_CONFIG_GROUP) {
|
} else if (group.name() == SCREEN_EDGES_CONFIG_GROUP) {
|
||||||
Q_EMIT screenEdgeTouchTargetChanged();
|
Q_EMIT screenEdgeTouchTargetChanged();
|
||||||
|
} else if (group.name() == DECORATION_CONFIG_GROUP) {
|
||||||
|
Q_EMIT titleButtonsChanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -64,3 +67,15 @@ void KWinSettings::setScreenEdgeTouchTarget(int target)
|
||||||
QDBusConnection::sessionBus().send(message);
|
QDBusConnection::sessionBus().send(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString KWinSettings::titleButtonsOnLeft() const
|
||||||
|
{
|
||||||
|
auto group = KConfigGroup{m_config, DECORATION_CONFIG_GROUP};
|
||||||
|
return group.readEntry("ButtonsOnLeft", QStringLiteral("MSE"));
|
||||||
|
}
|
||||||
|
|
||||||
|
QString KWinSettings::titleButtonsOnRight() const
|
||||||
|
{
|
||||||
|
auto group = KConfigGroup{m_config, DECORATION_CONFIG_GROUP};
|
||||||
|
return group.readEntry("ButtonsOnRight", QStringLiteral("HIAX"));
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ class KWinSettings : public QObject
|
||||||
|
|
||||||
Q_PROPERTY(bool doubleTapWakeup READ doubleTapWakeup WRITE setDoubleTapWakeup NOTIFY doubleTapWakeupChanged)
|
Q_PROPERTY(bool doubleTapWakeup READ doubleTapWakeup WRITE setDoubleTapWakeup NOTIFY doubleTapWakeupChanged)
|
||||||
Q_PROPERTY(int screenEdgeTouchTarget READ screenEdgeTouchTarget WRITE setScreenEdgeTouchTarget NOTIFY screenEdgeTouchTargetChanged)
|
Q_PROPERTY(int screenEdgeTouchTarget READ screenEdgeTouchTarget WRITE setScreenEdgeTouchTarget NOTIFY screenEdgeTouchTargetChanged)
|
||||||
|
Q_PROPERTY(QString titleButtonsOnLeft READ titleButtonsOnLeft NOTIFY titleButtonsChanged)
|
||||||
|
Q_PROPERTY(QString titleButtonsOnRight READ titleButtonsOnRight NOTIFY titleButtonsChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
KWinSettings(QObject *parent = nullptr);
|
KWinSettings(QObject *parent = nullptr);
|
||||||
|
|
@ -48,9 +50,20 @@ public:
|
||||||
*/
|
*/
|
||||||
void setScreenEdgeTouchTarget(int target);
|
void setScreenEdgeTouchTarget(int target);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configured KWin titlebar buttons on the left side.
|
||||||
|
*/
|
||||||
|
QString titleButtonsOnLeft() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configured KWin titlebar buttons on the right side.
|
||||||
|
*/
|
||||||
|
QString titleButtonsOnRight() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void doubleTapWakeupChanged();
|
void doubleTapWakeupChanged();
|
||||||
void screenEdgeTouchTargetChanged();
|
void screenEdgeTouchTargetChanged();
|
||||||
|
void titleButtonsChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KConfigWatcher::Ptr m_configWatcher;
|
KConfigWatcher::Ptr m_configWatcher;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue