From e95b9ebf1d3dc8e78ae02875f388a2876d54dd94 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Sat, 5 Nov 2022 08:21:39 -0700 Subject: [PATCH] Refresh the tray icon background when updating the background color * exwm-systemtray.el (exwm-systemtray--refresh-background-color): Add optional parameter REMAP to force redrawing of the background. (exwm-systemtray--on-theme-change): Use it. --- exwm-systemtray.el | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/exwm-systemtray.el b/exwm-systemtray.el index d2bd428..62e034e 100644 --- a/exwm-systemtray.el +++ b/exwm-systemtray.el @@ -258,11 +258,21 @@ using 32-bit depth. Using `workspace-background' instead.") :window exwm-systemtray--embedder-window)))) (xcb:flush exwm-systemtray--connection)) -(defun exwm-systemtray--refresh-background-color () - "Refresh background color after theme change or workspace switch." +(defun exwm-systemtray--refresh-background-color (&optional remap) + "Refresh background color after theme change or workspace switch. +If REMAP is not nil, map and unmap the embedder window so that the background is +redrawn." ;; Only `workspace-background' is dependent on current theme and workspace. (when (eq 'workspace-background exwm-systemtray-background-color) - (exwm-systemtray--set-background-color))) + (exwm-systemtray--set-background-color) + (when remap + (xcb:+request exwm-systemtray--connection + (make-instance 'xcb:UnmapWindow + :window exwm-systemtray--embedder-window)) + (xcb:+request exwm-systemtray--connection + (make-instance 'xcb:MapWindow + :window exwm-systemtray--embedder-window)) + (xcb:flush exwm-systemtray--connection)))) (defun exwm-systemtray--set-background-color () "Change the background color of the embedder. @@ -453,7 +463,7 @@ indicate how to support actual transparency." (defun exwm-systemtray--on-theme-change (_theme) "Refresh system tray upon theme change." - (exwm-systemtray--refresh-background-color)) + (exwm-systemtray--refresh-background-color 'remap)) (defun exwm-systemtray--refresh-all () "Reposition/Refresh the system tray."