about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--exwm-systemtray.el24
1 files changed, 24 insertions, 0 deletions
diff --git a/exwm-systemtray.el b/exwm-systemtray.el
index 861304ab7c4e..c85d7436bbb3 100644
--- a/exwm-systemtray.el
+++ b/exwm-systemtray.el
@@ -30,6 +30,7 @@
 
 ;;; Code:
 
+(require 'xcb-icccm)
 (require 'xcb-xembed)
 (require 'xcb-systemtray)
 (require 'exwm-core)
@@ -40,6 +41,15 @@
    (visible :initarg :visible))
   :documentation "Attributes of a system tray icon.")
 
+(defclass xcb:systemtray:-ClientMessage
+  (xcb:icccm:--ClientMessage xcb:ClientMessage)
+  ((format :initform 32)
+   (type :initform xcb:Atom:MANAGER)
+   (time :initarg :time :type xcb:TIMESTAMP)      ;new slot
+   (selection :initarg :selection :type xcb:ATOM) ;new slot
+   (owner :initarg :owner :type xcb:WINDOW))      ;new slot
+  :documentation "A systemtray client message.")
+
 ;; GTK icons require at least 16 pixels to show normally.
 (defconst exwm-systemtray--icon-min-size 16 "Minimum icon size.")
 
@@ -325,6 +335,20 @@ You shall use the default value if using auto-hide minibuffer.")
                        :owner id
                        :selection xcb:Atom:_NET_SYSTEM_TRAY_S0
                        :time xcb:Time:CurrentTime))
+    ;; Send a client message to announce the selection.
+    (xcb:+request exwm-systemtray--connection
+        (make-instance 'xcb:SendEvent
+                       :propagate 0
+                       :destination exwm--root
+                       :event-mask xcb:EventMask:StructureNotify
+                       :event (xcb:marshal
+                               (make-instance 'xcb:systemtray:-ClientMessage
+                                              :window exwm--root
+                                              :time xcb:Time:CurrentTime
+                                              :selection
+                                              xcb:Atom:_NET_SYSTEM_TRAY_S0
+                                              :owner id)
+                               exwm-systemtray--connection)))
     ;; Set _NET_WM_NAME.
     (xcb:+request exwm-systemtray--connection
         (make-instance 'xcb:ewmh:set-_NET_WM_NAME