Development/Architecture/KDE3/System Tray Docking

From KDE TechBase

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);

When the application maps the window with XMapWindow(), the window will dock into a system tray if possible. Undocking is done with either XUnmapWindow() or XDestroyWindow().

From the windowmanager's point of view

TODO (once it is done)

Warning
This section needs improvements: Please help us to

cleanup confusing sections and fix sections which contain a todo


From the docking-container's point of view

TODO (once it is done)


Initial Author: Matthias Ettrich