Manipulating X11 window menu in a WM-agnostic way

417 Views Asked by At

Motif-based window managers (Mwm, Dtwm, 4Dwm, 5Dwm) allow custom menu items (with the corresponding callbacks) to be added to the application's window menu (see the screenshot, gist available here). The application itself is also required to link with -lXm (at least for XmAddProtocols() and XmAddProtocolCallback() to be available).

Mwm custom window menu

From the X Window perspective, this is achieved via a couple of extra Atoms set by the client:

_MOTIF_WM_MESSAGES(ATOM) = _MOTIF_WM_OFFSET, CUSTOM_MENU_ACTION_A, CUSTOM_MENU_ACTION_B
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, _MOTIF_WM_MESSAGES
_MOTIF_WM_MENU(STRING) = "no-label                                 f.separator\n
    Custom\ Menu\ Title                      f.title\n
    XTerm                                    f.exec \"xterm &\"\n
    Custom\ Menu\ Action\ A Shift Alt<Key>F1 f.send_msg 393\n
    Custom\ Menu\ Action\ B Shift Alt<Key>F2 f.send_msg 394\n"

Apparently, this behavior is not supported by any of the modern EWMH-compliant window managers. Additionally, EWMH specification doesn't seem to provide any alternative.

Is there any non-Motif cross-WM way to manipulate the window menu (GTK, Qt or Xlib)?

0

There are 0 best solutions below