2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 22:46:10 +00:00

Change color of wayland decoration according to theme

This commit is contained in:
Ilya Fedin
2020-04-25 08:43:19 +04:00
committed by John Preston
parent 46d4b03d49
commit 161e51757c
7 changed files with 111 additions and 11 deletions

View File

@@ -456,6 +456,11 @@ void MainWindow::initHook() {
LOG(("Not using Unity launcher counter."));
}
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
style::PaletteChanged(
) | rpl::start_with_next([=] {
updateWaylandDecorationColors();
}, lifetime());
}
bool MainWindow::hasTrayIcon() const {
@@ -676,6 +681,13 @@ void MainWindow::updateIconCounters() {
}
}
void MainWindow::updateWaylandDecorationColors() {
windowHandle()->setProperty("__material_decoration_backgroundColor", st::titleBgActive->c);
windowHandle()->setProperty("__material_decoration_foregroundColor", st::titleFgActive->c);
windowHandle()->setProperty("__material_decoration_backgroundInactiveColor", st::titleBg->c);
windowHandle()->setProperty("__material_decoration_foregroundInactiveColor", st::titleFg->c);
}
void MainWindow::LibsLoaded() {
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
qDBusRegisterMetaType<ToolTip>();

View File

@@ -94,6 +94,7 @@ private:
Ui::PopupMenu *_trayIconMenuXEmbed = nullptr;
void updateIconCounters();
void updateWaylandDecorationColors();
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
StatusNotifierItem *_sniTrayIcon = nullptr;

View File

@@ -634,7 +634,14 @@ void start() {
qputenv("PULSE_PROP_application.name", AppName.utf8());
qputenv("PULSE_PROP_application.icon_name", GetIconName().toLatin1());
if(IsStaticBinary()
if(IsStaticBinary()
|| InAppImage()
|| InSandbox()
|| InSnap()) {
qputenv("QT_WAYLAND_DECORATION", "material");
}
if(IsStaticBinary()
|| InAppImage()
|| InSnap()
|| IsGtkFileDialogForced()) {