14 #define FOREACH_NONINTERNAL \
15 TAILQ_FOREACH(output, &(croot->nodes_head), nodes) \
16 TAILQ_FOREACH(ws, &(output_get_content(output)->nodes_head), nodes) \
17 if (!con_is_internal(ws))
35 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
root, A__NET_CURRENT_DESKTOP, XCB_ATOM_CARDINAL, 32, 1, &idx);
44 static uint32_t old_idx = 0;
56 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
root,
57 A__NET_NUMBER_OF_DESKTOPS, XCB_ATOM_CARDINAL, 32, 1, &idx);
70 msg_length += strlen(ws->
name) + 1;
73 char desktop_names[msg_length];
74 int current_position = 0;
78 for (
size_t i = 0; i < strlen(ws->
name) + 1; i++) {
79 desktop_names[current_position++] = ws->
name[i];
83 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
root,
84 A__NET_DESKTOP_NAMES, A_UTF8_STRING, 8, msg_length, desktop_names);
99 uint32_t viewports[num_desktops * 2];
101 int current_position = 0;
104 viewports[current_position++] = output->
rect.
x;
105 viewports[current_position++] = output->
rect.
y;
108 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
root,
109 A__NET_DESKTOP_VIEWPORT, XCB_ATOM_CARDINAL, 32, current_position, &viewports);
133 if (
con->
type == CT_WORKSPACE) {
142 uint32_t wm_desktop = desktop;
167 DLOG(
"Setting _NET_WM_DESKTOP = %d for window 0x%08x.\n", wm_desktop, window);
168 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE, window, A__NET_WM_DESKTOP, XCB_ATOM_CARDINAL, 32, 1, &wm_desktop);
172 ELOG(
"Failed to determine the proper EWMH desktop index for window 0x%08x, deleting _NET_WM_DESKTOP.\n", window);
173 xcb_delete_property(
conn, window, A__NET_WM_DESKTOP);
183 uint32_t desktop = 0;
206 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
root,
207 A__NET_ACTIVE_WINDOW, XCB_ATOM_WINDOW, 32, 1, &window);
216 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE, window, A__NET_WM_VISIBLE_NAME, A_UTF8_STRING, 8, strlen(name), name);
218 xcb_delete_property(
conn, window, A__NET_WM_VISIBLE_NAME);
238 xcb_delete_property(
conn,
root, A__NET_WORKAREA);
248 XCB_PROP_MODE_REPLACE,
264 XCB_PROP_MODE_REPLACE,
266 A__NET_CLIENT_LIST_STACKING,
279 DLOG(
"Setting _NET_WM_STATE_STICKY for window = %d.\n", window);
282 DLOG(
"Removing _NET_WM_STATE_STICKY for window = %d.\n", window);
293 DLOG(
"Setting _NET_WM_STATE_FOCUSED for window = %d.\n", window);
296 DLOG(
"Removing _NET_WM_STATE_FOCUSED for window = %d.\n", window);
306 xcb_atom_t supported_atoms[] = {
307 #define xmacro(atom) A_##atom,
308 #include "atoms_NET_SUPPORTED.xmacro"
321 XCB_COPY_FROM_PARENT,
326 XCB_WINDOW_CLASS_INPUT_ONLY,
327 XCB_COPY_FROM_PARENT,
328 XCB_CW_OVERRIDE_REDIRECT,
330 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
ewmh_window, A__NET_SUPPORTING_WM_CHECK, XCB_ATOM_WINDOW, 32, 1, &
ewmh_window);
331 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
ewmh_window, A__NET_WM_NAME, A_UTF8_STRING, 8, strlen(
"i3"),
"i3");
332 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
root, A__NET_SUPPORTING_WM_CHECK, XCB_ATOM_WINDOW, 32, 1, &
ewmh_window);
335 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
root, A__NET_WM_NAME, A_UTF8_STRING, 8, strlen(
"i3"),
"i3");
337 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);
341 xcb_configure_window(
conn,
ewmh_window, XCB_CONFIG_WINDOW_STACK_MODE, (uint32_t[]){XCB_STACK_MODE_BELOW});
355 uint32_t current_index = 0;
359 if (current_index == idx) {
381 if (ws == target_workspace) {