Development/Architecture/KDE3/System Tray Docking

Jump to: navigation, search

KDE Architecture - System Tray Docking Protocol

The KDE System Tray Docking Protocol

A tray window is a small window (typically 24x24 pixel) that docks into the system tray in the desktop panel. It usually displays an icon or an animated icon there. The icon serves as representative for the application, similar to a taskbar button, but consumes less screen space.

This page contains just the raw protocol description. More information on the system tray itself and how to use it with KDE applications can be found in the section Components/SystemTrayDocking of this architecture overview.

From the application's point of view

For the application, a tray window is just another toplevel window with one special property defined. The property is called _KDE_NET_SYSTEM_TRAY_WINDOW_FOR and is of type XA_WINDOW, format 32.

The pure existence of this property indicates that the window manager should treat this window as a tray window. The property value may further define the tray window's main window, i.e. the window the tray window is representing.

The following code can be used to declare a window a tray window:

/** Prototypes:
    Display dpy;
    Window trayWin, forWin;
*/
Atom kde_net_wm_system_tray_window_for =
  XInternAtom( dpy, "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False);
XChangeProperty( dpy, trayWin, kde_net_wm_system_tray_window_for,
                 XA_WINDOW, 32, PropModeReplace,
                 (unsigned char *)&forWin, 1);
</code>
 
When the application maps the window with <tt>XMapWindow()</tt>,
the window will dock into a system tray  if possible. Undocking is done with either
<tt>XUnmapWindow()</tt> or <tt>XDestroyWindow()</tt>.
 
== From the windowmanager's point of view ==
 
TODO (once it is done)
{{improve}}
 
== From the docking-container's point of view ==
 
TODO (once it is done)
 
 
''Initial Author:'' [mailto:ettrich@kde.org Matthias Ettrich]
 
[[Category:KDE3]]
[[Category:Architecture]]

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal