mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-21 02:01:03 +07:00
21 lines
565 B
C++
21 lines
565 B
C++
|
|
#include "linuxtraytheme.h"
|
||
|
|
|
||
|
|
#include "platforms/linux/linuxutils.h"
|
||
|
|
|
||
|
|
#include <QGuiApplication>
|
||
|
|
#include <QObject>
|
||
|
|
#include <QStyleHints>
|
||
|
|
|
||
|
|
void LinuxTrayTheme::installThemeObserver(const std::function<void()> &onThemeChanged, QObject *parent)
|
||
|
|
{
|
||
|
|
if (!onThemeChanged || !parent) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (QStyleHints *styleHints = QGuiApplication::styleHints()) {
|
||
|
|
QObject::connect(styleHints, &QStyleHints::colorSchemeChanged, parent, [onThemeChanged]() { onThemeChanged(); });
|
||
|
|
}
|
||
|
|
|
||
|
|
LinuxUtils::installThemeChangeObserver(onThemeChanged);
|
||
|
|
}
|