about summary refs log tree commit diff
path: root/exwm-systemtray.el
diff options
context:
space:
mode:
authorSteven Allen <steven@stebalien.com>2022-11-05T15·21-0700
committerAdrián Medraño Calvo <adrian@medranocalvo.com>2022-11-09T00·00+0000
commite95b9ebf1d3dc8e78ae02875f388a2876d54dd94 (patch)
treedfa6dc8a5ca389fbc5b7d244e77de0f4d43fb935 /exwm-systemtray.el
parentb3766e52d639a500e792f38572e79c2f6f044625 (diff)
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.
Diffstat (limited to 'exwm-systemtray.el')
-rw-r--r--exwm-systemtray.el18
1 files changed, 14 insertions, 4 deletions
diff --git a/exwm-systemtray.el b/exwm-systemtray.el
index d2bd428c8c92..62e034ef7c2c 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."