expose colorScheme to lastActiveWindow(s)

--applets can now use the color scheme from lastActiveWindow
objects in order to paint some of their elements
pull/9/head
Michail Vourlakos 5 years ago
parent dc0a9a8f22
commit c2a1c20d92

@ -20,6 +20,7 @@
#include "lastactivewindow.h"
// local
#include "schemes.h"
#include "trackedgeneralinfo.h"
#include "windowstracker.h"
#include "../abstractwindowinterface.h"
@ -220,6 +221,21 @@ void LastActiveWindow::setAppName(QString appName)
emit appNameChanged();
}
QString LastActiveWindow::colorScheme() const
{
return m_colorScheme;
}
void LastActiveWindow::setColorScheme(QString scheme)
{
if (m_colorScheme == scheme){
return;
}
m_colorScheme = scheme;
emit colorSchemeChanged();
}
QString LastActiveWindow::display() const
{
return m_display;
@ -272,6 +288,12 @@ void LastActiveWindow::setWinId(QVariant winId)
void LastActiveWindow::setInformation(const WindowInfoWrap &info)
{
bool firstActiveness{false};
if (m_winId != info.wid()) {
firstActiveness = true;
}
setWinId(info.wid());
setIsValid(true);
@ -285,6 +307,11 @@ void LastActiveWindow::setInformation(const WindowInfoWrap &info)
setGeometry(info.geometry());
setIsKeepAbove(info.isKeepAbove());
auto scheme = m_wm->schemesTracker()->schemeForWindow(info.wid());
if (scheme) {
setColorScheme(scheme->schemeFile());
}
if (info.appName().isEmpty()) {
setAppName(m_windowsTracker->appNameFor(info.wid()));
} else {

@ -55,6 +55,9 @@ class LastActiveWindow : public QObject {
Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged)
Q_PROPERTY(bool hasSkipTaskbar READ hasSkipTaskbar NOTIFY hasSkipTaskbarChanged)
/*since Latte v0.9.4*/
Q_PROPERTY(QString colorScheme READ colorScheme NOTIFY colorSchemeChanged)
Q_PROPERTY(QString appName READ appName NOTIFY appNameChanged)
Q_PROPERTY(QString display READ display NOTIFY displayChanged)
Q_PROPERTY(QRect geometry READ geometry NOTIFY geometryChanged)
@ -78,7 +81,8 @@ public:
bool hasSkipTaskbar() const;
QString appName() const;
QString display() const;
QString colorScheme() const;
QString display() const;
QRect geometry() const;
QIcon icon() const;
@ -105,6 +109,7 @@ private slots:
signals:
void colorSchemeChanged();
void iconChanged();
void isActiveChanged();
void isMinimizedChanged();
@ -114,7 +119,7 @@ signals:
void isOnAllDesktopsChanged();
void isShadedChanged();
void isValidChanged();
void hasSkipTaskbarChanged();
void hasSkipTaskbarChanged();
void appNameChanged();
void displayChanged();
@ -133,6 +138,8 @@ private:
void setIsValid(bool valid);
void setHasSkipTaskbar(bool skip);
void setColorScheme(QString scheme);
void setAppName(QString appName);
void setDisplay(QString display);
@ -154,6 +161,8 @@ private:
bool m_isValid{false};
bool m_hasSkipTaskbar{false};
QString m_colorScheme;
QString m_appName;
QString m_display;

@ -66,7 +66,7 @@ Item {
property bool debugModeWindow: Qt.application.arguments.indexOf("--with-window")>=0
property bool debugModeOverloadedIcons: Qt.application.arguments.indexOf("--overloaded-icons")>=0
readonly property int version: Latte.WindowSystem.makeVersion(0,9,0)
readonly property int version: Latte.WindowSystem.makeVersion(0,9,4)
property bool globalDirectRender: false //it is used as a globalDirectRender for all elements in the dock
property int directRenderAnimationTime: 0

Loading…
Cancel
Save