16 #define FOREACH_NONINTERNAL \
17 TAILQ_FOREACH (output, &(croot->nodes_head), nodes) \
18 TAILQ_FOREACH (ws, &(output_get_content(output)->nodes_head), nodes) \
19 if (!con_is_internal(ws))
37 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
root, A__NET_CURRENT_DESKTOP, XCB_ATOM_CARDINAL, 32, 1, &idx);
46 static uint32_t old_idx = 0;
58 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
root,
59 A__NET_NUMBER_OF_DESKTOPS, XCB_ATOM_CARDINAL, 32, 1, &idx);
72 msg_length += strlen(ws->
name) + 1;
75 char desktop_names[msg_length];
76 int current_position = 0;
80 for (
size_t i = 0; i < strlen(ws->
name) + 1; i++) {
81 desktop_names[current_position++] = ws->
name[i];
85 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
root,
86 A__NET_DESKTOP_NAMES, A_UTF8_STRING, 8, msg_length, desktop_names);
101 uint32_t viewports[num_desktops * 2];
103 int current_position = 0;
106 viewports[current_position++] = output->
rect.
x;
107 viewports[current_position++] = output->
rect.
y;
110 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
root,
111 A__NET_DESKTOP_VIEWPORT, XCB_ATOM_CARDINAL, 32, current_position, &viewports);
135 if (
con->
type == CT_WORKSPACE) {
144 uint32_t wm_desktop = desktop;
169 DLOG(
"Setting _NET_WM_DESKTOP = %d for window 0x%08x.\n", wm_desktop, window);
170 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE, window, A__NET_WM_DESKTOP, XCB_ATOM_CARDINAL, 32, 1, &wm_desktop);
174 ELOG(
"Failed to determine the proper EWMH desktop index for window 0x%08x, deleting _NET_WM_DESKTOP.\n", window);
175 xcb_delete_property(
conn, window, A__NET_WM_DESKTOP);
185 uint32_t desktop = 0;
208 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
root,
209 A__NET_ACTIVE_WINDOW, XCB_ATOM_WINDOW, 32, 1, &window);
218 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE, window, A__NET_WM_VISIBLE_NAME, A_UTF8_STRING, 8, strlen(name), name);
220 xcb_delete_property(
conn, window, A__NET_WM_VISIBLE_NAME);
240 xcb_delete_property(
conn,
root, A__NET_WORKAREA);
250 XCB_PROP_MODE_REPLACE,
266 XCB_PROP_MODE_REPLACE,
268 A__NET_CLIENT_LIST_STACKING,
281 DLOG(
"Setting _NET_WM_STATE_STICKY for window = %d.\n", window);
284 DLOG(
"Removing _NET_WM_STATE_STICKY for window = %d.\n", window);
295 DLOG(
"Setting _NET_WM_STATE_FOCUSED for window = %d.\n", window);
298 DLOG(
"Removing _NET_WM_STATE_FOCUSED for window = %d.\n", window);
308 xcb_atom_t supported_atoms[] = {
309 #define xmacro(atom) A_##atom,
323 XCB_COPY_FROM_PARENT,
328 XCB_WINDOW_CLASS_INPUT_ONLY,
329 XCB_COPY_FROM_PARENT,
330 XCB_CW_OVERRIDE_REDIRECT,
332 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
ewmh_window, A__NET_SUPPORTING_WM_CHECK, XCB_ATOM_WINDOW, 32, 1, &
ewmh_window);
333 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
ewmh_window, A__NET_WM_NAME, A_UTF8_STRING, 8, strlen(
"i3"),
"i3");
334 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
root, A__NET_SUPPORTING_WM_CHECK, XCB_ATOM_WINDOW, 32, 1, &
ewmh_window);
337 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
root, A__NET_WM_NAME, A_UTF8_STRING, 8, strlen(
"i3"),
"i3");
339 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
root, A__NET_SUPPORTED, XCB_ATOM_ATOM, 32,
sizeof(supported_atoms) /
sizeof(xcb_atom_t), supported_atoms);
343 xcb_configure_window(
conn,
ewmh_window, XCB_CONFIG_WINDOW_STACK_MODE, (uint32_t[]){XCB_STACK_MODE_BELOW});
357 uint32_t current_index = 0;
361 if (current_index == idx) {
383 if (ws == target_workspace) {