}
}
+/*
+ * 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.
*
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);
/* I’m 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");
x_set_i3_atoms();
ewmh_update_workarea();
- /* Set the _NET_CURRENT_DESKTOP property. */
+ /* Set the ewmh desktop properties. */
ewmh_update_current_desktop();
+ ewmh_update_number_of_desktops();
struct ev_io *xcb_watcher = scalloc(sizeof(struct ev_io));
struct ev_io *xkb = scalloc(sizeof(struct ev_io));
con_attach(workspace, content, false);
ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, "{\"change\":\"init\"}");
+ ewmh_update_number_of_desktops();
if (created != NULL)
*created = true;
} else if (created != NULL) {
LOG("Closing old workspace (%p / %s), it is empty\n", old, old->name);
tree_close(old, DONT_KILL_WINDOW, false, false);
ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, "{\"change\":\"empty\"}");
+ ewmh_update_number_of_desktops();
}
}