Expose AbstractClient's colorScheme as a property

Summary:
This exposes colorScheme as a property which is then usable by kwin
scripts.
Wanted by T9769.

Test Plan:
Michail to test in a script.

Reviewers: #kwin, zzag, graesslin

Reviewed By: #kwin, zzag, graesslin

Subscribers: mvourlakos, zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D15913
This commit is contained in:
David Edmundson 2018-10-08 09:32:57 +01:00
parent e60c878647
commit 2d3431aede
2 changed files with 13 additions and 0 deletions

View file

@ -696,6 +696,7 @@ void AbstractClient::updateColorScheme(QString path)
connect(m_palette.get(), &Decoration::DecorationPalette::changed, this, &AbstractClient::handlePaletteChange);
emit paletteChanged(palette());
emit colorSchemeChanged();
}
}

View file

@ -278,6 +278,14 @@ class KWIN_EXPORT AbstractClient : public Toplevel
**/
Q_PROPERTY(KWin::TabGroup* tabGroup READ tabGroup NOTIFY tabGroupChanged SCRIPTABLE false)
/**
* The color scheme set on this client
* Absolute file path, or name of palette in the user's config directory following KColorSchemes format.
* An empty string indicates the default palette from kdeglobals is used.
* @Note this indicates the colour scheme requested, which might differ from the theme applied if the colorScheme cannot be found
*/
Q_PROPERTY(QString colorScheme READ colorScheme NOTIFY colorSchemeChanged)
public:
virtual ~AbstractClient();
@ -714,6 +722,9 @@ public:
QString applicationMenuObjectPath() const {
return m_applicationMenuObjectPath;
}
QString colorScheme() const {
return m_colorScheme;
}
/**
* Request showing the application menu bar
@ -750,6 +761,7 @@ Q_SIGNALS:
void clientMinimized(KWin::AbstractClient* client, bool animate);
void clientUnminimized(KWin::AbstractClient* client, bool animate);
void paletteChanged(const QPalette &p);
void colorSchemeChanged();
void captionChanged();
void clientMaximizedStateChanged(KWin::AbstractClient*, MaximizeMode);
void clientMaximizedStateChanged(KWin::AbstractClient* c, bool h, bool v);