Implement EWMH number of desktops property

_NET_NUMBER_OF_DESKTOPS:

> This property SHOULD be set and updated by the Window Manager to
> indicate the number of virtual desktops.

We interpret this property as the number of noninternal workspaces.
This commit is contained in:
Tony Crisci
2014-06-16 02:50:47 -04:00
committed by Michael Stapelberg
parent 4c06e7a573
commit b47f480728
5 changed files with 33 additions and 2 deletions

View File

@ -40,6 +40,27 @@ void ewmh_update_current_desktop(void) {
}
}
/*
* Updates _NET_NUMBER_OF_DESKTOPS which we interpret as the number of
* noninternal workspaces.
*/
void ewmh_update_number_of_desktops(void) {
Con *output;
uint32_t idx = 0;
TAILQ_FOREACH (output, &(croot->nodes_head), nodes) {
Con *ws;
TAILQ_FOREACH (ws, &(output_get_content(output)->nodes_head), nodes) {
if (STARTS_WITH(ws->name, "__"))
continue;
++idx;
}
}
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root,
A__NET_NUMBER_OF_DESKTOPS, XCB_ATOM_CARDINAL, 32, 1, &idx);
}
/*
* Updates _NET_ACTIVE_WINDOW with the currently focused window.
*
@ -133,7 +154,7 @@ void ewmh_setup_hints(void) {
NULL);
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, child_window, A__NET_SUPPORTING_WM_CHECK, XCB_ATOM_WINDOW, 32, 1, &child_window);
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, child_window, A__NET_WM_NAME, A_UTF8_STRING, 8, strlen("i3"), "i3");
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_SUPPORTING_WM_CHECK, XCB_ATOM_WINDOW, 32, 1, &child_window);
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_SUPPORTING_WM_CHECK, XCB_ATOM_WINDOW, 33, 1, &child_window);
/* Im not entirely sure if we need to keep _NET_WM_NAME on root. */
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_WM_NAME, A_UTF8_STRING, 8, strlen("i3"), "i3");