24 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
root, A__NET_CURRENT_DESKTOP, XCB_ATOM_CARDINAL, 32, 1, &idx);
45 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
root,
46 A__NET_NUMBER_OF_DESKTOPS, XCB_ATOM_CARDINAL, 32, 1, &idx);
63 msg_length += strlen(ws->
name) + 1;
67 char desktop_names[msg_length];
68 int current_position = 0;
77 for (
size_t i = 0; i < strlen(ws->
name) + 1; i++) {
78 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);
105 uint32_t viewports[num_desktops * 2];
107 int current_position = 0;
115 viewports[current_position++] = output->
rect.
x;
116 viewports[current_position++] = output->
rect.
y;
120 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
root,
121 A__NET_DESKTOP_VIEWPORT, XCB_ATOM_CARDINAL, 32, current_position, &viewports);
133 if (con->
type == CT_WORKSPACE) {
142 uint32_t wm_desktop = desktop;
165 const xcb_window_t window = con->
window->
id;
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);
292 xcb_atom_t supported_atoms[] = {
293 #define xmacro(atom) A_##atom, 294 #include "atoms_NET_SUPPORTED.xmacro" 307 XCB_COPY_FROM_PARENT,
312 XCB_WINDOW_CLASS_INPUT_ONLY,
313 XCB_COPY_FROM_PARENT,
314 XCB_CW_OVERRIDE_REDIRECT,
316 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
ewmh_window, A__NET_SUPPORTING_WM_CHECK, XCB_ATOM_WINDOW, 32, 1, &
ewmh_window);
317 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
ewmh_window, A__NET_WM_NAME, A_UTF8_STRING, 8, strlen(
"i3"),
"i3");
318 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
root, A__NET_SUPPORTING_WM_CHECK, XCB_ATOM_WINDOW, 32, 1, &
ewmh_window);
321 xcb_change_property(
conn, XCB_PROP_MODE_REPLACE,
root, A__NET_WM_NAME, A_UTF8_STRING, 8, strlen(
"i3"),
"i3");
323 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);
327 xcb_configure_window(
conn,
ewmh_window, XCB_CONFIG_WINDOW_STACK_MODE, (uint32_t[]){XCB_STACK_MODE_BELOW});
341 uint32_t current_index = 0;
350 if (current_index == idx)
378 if (current == workspace)
xcb_window_t ewmh_window
The EWMH support window that is used to indicate that an EWMH-compliant window manager is present...
uint32_t wm_desktop
The _NET_WM_DESKTOP for this window.
void xcb_add_property_atom(xcb_connection_t *conn, xcb_window_t window, xcb_atom_t property, xcb_atom_t atom)
Add an atom to a list of atoms the given property defines.
uint32_t ewmh_get_workspace_index(Con *con)
Returns the EWMH desktop index for the workspace the given container is on.
void ewmh_update_wm_desktop(void)
Updates _NET_WM_DESKTOP for all windows.
A 'Con' represents everything from the X11 root window down to a single X11 window.
Con * ewmh_get_workspace_by_index(uint32_t idx)
Returns the workspace container as enumerated by the EWMH desktop model.
xcb_connection_t * conn
XCB connection and root screen.
#define NET_WM_DESKTOP_ALL
void ewmh_update_sticky(xcb_window_t window, bool sticky)
Set or remove _NET_WM_STATE_STICKY on the window.
void ewmh_update_number_of_desktops(void)
Updates _NET_NUMBER_OF_DESKTOPS which we interpret as the number of noninternal workspaces.
void xcb_remove_property_atom(xcb_connection_t *conn, xcb_window_t window, xcb_atom_t property, xcb_atom_t atom)
Remove an atom from a list of atoms the given property defines without removing any other potentially...
void ewmh_update_current_desktop(void)
Updates _NET_CURRENT_DESKTOP with the current desktop number.
void ewmh_update_workarea(void)
i3 currently does not support _NET_WORKAREA, because it does not correspond to i3’s concept of works...
void ewmh_update_client_list(xcb_window_t *list, int num_windows)
Updates the _NET_CLIENT_LIST hint.
void ewmh_setup_hints(void)
Set up the EWMH hints on the root window.
void ewmh_update_desktop_viewport(void)
Updates _NET_DESKTOP_VIEWPORT, which is an array of pairs of cardinals that define the top left corne...
Con * con_get_workspace(Con *con)
Gets the workspace container this node is on.
#define TAILQ_FOREACH(var, head, field)
bool con_is_floating(Con *con)
Returns true if the node is floating.
void ewmh_update_active_window(xcb_window_t window)
Updates _NET_ACTIVE_WINDOW with the currently focused window.
static void ewmh_update_wm_desktop_recursively(Con *con, const uint32_t desktop)
bool con_has_managed_window(Con *con)
Returns true when this con is a leaf node with a managed X11 window (e.g., excluding dock containers)...
void ewmh_update_desktop_names(void)
Updates _NET_DESKTOP_NAMES: "The names of all virtual desktops.
bool con_is_internal(Con *con)
Returns true if the container is internal, such as __i3_scratch.
Con * output_get_content(Con *output)
Returns the output container below the given output container.
#define NET_WM_DESKTOP_NONE
bool con_is_sticky(Con *con)
Returns whether the container or any of its children is sticky.
void ewmh_update_visible_name(xcb_window_t window, const char *name)
Updates _NET_WM_VISIBLE_NAME.
static struct stack_entry stack[10]
void ewmh_update_client_list_stacking(xcb_window_t *stack, int num_windows)
Updates the _NET_CLIENT_LIST_STACKING hint.
#define STARTS_WITH(string, needle)