about summary refs log tree commit diff
path: root/exwm-systemtray.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2016-04-21T13·37+0800
committerChris Feng <chris.w.feng@gmail.com>2016-04-21T13·37+0800
commit009854e766728ed17741bf9f7e6d86f9ccc71871 (patch)
tree061fbc878dc7106056a6719f89dfbbb5552c7a65 /exwm-systemtray.el
parent367bdf2e1918dd61780e2284a4c89d5ef8cd1254 (diff)
Announce manager selection with client message
* exwm-systemtray.el (exwm-systemtray--init): Send a client message to
announce the manager selection.
(xcb:systemtray:-ClientMessage): The client message.
Diffstat (limited to 'exwm-systemtray.el')
-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