From 638a57379b9d2bfece79d28646f5e3ba172c181d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Gro=C3=9Fgasteiger?= Date: Mon, 7 Mar 2022 19:16:07 +0100 Subject: [PATCH] Redraw tray on wallpaper change, only if transparent (#2604) The tray manager of polybar listens on multiple atoms for the background of the root window. On change of these atoms, it will redraw its window-background and message its tray-client to redraw also. On fast changes of of background, this leads to immense messaging and eventual flickering of the systray. This patch tries to soften the issue in a way, that tray-window and its client will only redraw, if the bar has transparency. If not, there should be no reason to redraw on wallpaper-change. * Redraw on background change only if transparent * Replace tab with spaces --- src/x11/tray_manager.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/x11/tray_manager.cpp b/src/x11/tray_manager.cpp index 81c70d06..dfce8521 100644 --- a/src/x11/tray_manager.cpp +++ b/src/x11/tray_manager.cpp @@ -1013,13 +1013,15 @@ void tray_manager::handle(const evt::selection_clear& evt) { void tray_manager::handle(const evt::property_notify& evt) { if (!m_activated) { return; - } else if (evt->atom == _XROOTPMAP_ID) { + } + + // React an wallpaper change, if bar has transparency + if (m_opts.transparent && (evt->atom == _XROOTPMAP_ID || evt->atom == _XSETROOT_ID || evt->atom == ESETROOT_PMAP_ID)) { redraw_window(true); - } else if (evt->atom == _XSETROOT_ID) { - redraw_window(true); - } else if (evt->atom == ESETROOT_PMAP_ID) { - redraw_window(true); - } else if (evt->atom != _XEMBED_INFO) { + return; + } + + if (evt->atom != _XEMBED_INFO) { return; }