From 009854e766728ed17741bf9f7e6d86f9ccc71871 Mon Sep 17 00:00:00 2001 From: Chris Feng Date: Thu, 21 Apr 2016 21:37:02 +0800 Subject: [PATCH] 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. --- exwm-systemtray.el | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/exwm-systemtray.el b/exwm-systemtray.el index 861304ab7..c85d7436b 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