i3
con.h
Go to the documentation of this file.
1 /*
2  * vim:ts=4:sw=4:expandtab
3  *
4  * i3 - an improved dynamic tiling window manager
5  * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
6  *
7  * con.c: Functions which deal with containers directly (creating containers,
8  * searching containers, getting specific properties from containers,
9  * …).
10  *
11  */
12 #pragma once
13 
14 #include <config.h>
15 
21 Con *con_new_skeleton(Con *parent, i3Window *window);
22 
23 /* A wrapper for con_new_skeleton, to retain the old con_new behaviour
24  *
25  */
26 Con *con_new(Con *parent, i3Window *window);
27 
32 void con_free(Con *con);
33 
39 void con_focus(Con *con);
40 
45 void con_close(Con *con, kill_window_t kill_window);
46 
51 bool con_is_leaf(Con *con);
52 
57 bool con_has_managed_window(Con *con);
58 
63 bool con_is_split(Con *con);
64 
70 bool con_is_hidden(Con *con);
71 
76 bool con_is_sticky(Con *con);
77 
82 bool con_has_children(Con *con);
83 
89 bool con_accepts_window(Con *con);
90 
96 Con *con_get_output(Con *con);
97 
102 Con *con_get_workspace(Con *con);
103 
110 
115 Con *con_get_fullscreen_con(Con *con, fullscreen_mode_t fullscreen_mode);
116 
121 bool con_is_internal(Con *con);
122 
127 bool con_is_floating(Con *con);
128 
133 bool con_is_docked(Con *con);
134 
141 
146 bool con_inside_focused(Con *con);
147 
152 bool con_has_parent(Con *con, Con *parent);
153 
159 Con *con_by_window_id(xcb_window_t window);
160 
166 Con *con_by_con_id(long target);
167 
173 bool con_exists(Con *con);
174 
180 Con *con_by_frame_id(xcb_window_t frame);
181 
187 Con *con_by_mark(const char *mark);
188 
193 bool con_has_mark(Con *con, const char *mark);
194 
201 void con_mark_toggle(Con *con, const char *mark, mark_mode_t mode);
202 
207 void con_mark(Con *con, const char *mark, mark_mode_t mode);
208 
209 /*
210  * Removes marks from containers.
211  * If con is NULL, all containers are considered.
212  * If name is NULL, this removes all existing marks.
213  * Otherwise, it will only remove the given mark (if it is present).
214  *
215  */
216 void con_unmark(Con *con, const char *name);
217 
223 Con *con_for_window(Con *con, i3Window *window, Match **store_match);
224 
229 int con_num_children(Con *con);
230 
236 int con_num_visible_children(Con *con);
237 
242 int con_num_windows(Con *con);
243 
254 void con_attach(Con *con, Con *parent, bool ignore_focus);
255 
260 void con_detach(Con *con);
261 
268 void con_fix_percent(Con *con);
269 
275 void con_toggle_fullscreen(Con *con, int fullscreen_mode);
276 
281 void con_enable_fullscreen(Con *con, fullscreen_mode_t fullscreen_mode);
282 
287 void con_disable_fullscreen(Con *con);
288 
309 void con_move_to_workspace(Con *con, Con *workspace, bool fix_coordinates,
310  bool dont_warp, bool ignore_focus);
311 
317 void con_move_to_output(Con *con, Output *output);
318 
323 bool con_move_to_mark(Con *con, const char *mark);
324 
332 
339 Con *con_next_focused(Con *con);
340 
346 Con *con_get_next(Con *con, char way, orientation_t orientation);
347 
355 
365 
366 /*
367  * Returns the leftmost, rightmost, etc. container in sub-tree. For example, if
368  * direction is D_LEFT, then we return the rightmost container and if direction
369  * is D_RIGHT, we return the leftmost container. This is because if we are
370  * moving D_LEFT, and thus want the rightmost container.
371  */
372 Con *con_descend_direction(Con *con, direction_t direction);
373 
381 
387 
398 int con_border_style(Con *con);
399 
405 void con_set_border_style(Con *con, int border_style, int border_width);
406 
413 void con_set_layout(Con *con, layout_t layout);
414 
422 void con_toggle_layout(Con *con, const char *toggle_mode);
423 
430 
453 
458 bool con_has_urgent_child(Con *con);
459 
466 
471 void con_set_urgency(Con *con, bool urgent);
472 
477 char *con_get_tree_representation(Con *con);
478 
484 
490 
495 bool con_swap(Con *first, Con *second);
void con_set_layout(Con *con, layout_t layout)
This function changes the layout of a given container.
Definition: con.c:1711
bool con_is_floating(Con *con)
Returns true if the node is floating.
Definition: con.c:510
struct _i3String i3String
Opaque data structure for storing strings.
Definition: libi3.h:48
bool con_exists(Con *con)
Returns true if the given container (still) exists.
Definition: con.c:612
A &#39;Window&#39; is a type which contains an xcb_window_t and all the related information (hints like _NET_...
Definition: data.h:401
Con * con_by_con_id(long target)
Returns the container with the given container ID or NULL if no such container exists.
Definition: con.c:596
bool con_has_parent(Con *con, Con *parent)
Checks if the container has the given parent as an actual parent.
Definition: con.c:565
void con_attach(Con *con, Con *parent, bool ignore_focus)
Attaches the given container to the given parent.
Definition: con.c:199
direction_t
Definition: data.h:55
void con_toggle_layout(Con *con, const char *toggle_mode)
This function toggles the layout of a given container.
Definition: con.c:1804
void con_disable_fullscreen(Con *con)
Disables fullscreen mode for the given container, if necessary.
Definition: con.c:1009
Con * con_by_mark(const char *mark)
Returns the container with the given mark or NULL if no such container exists.
Definition: con.c:634
void con_focus(Con *con)
Sets input focus to the given container.
Definition: con.c:223
A &#39;Con&#39; represents everything from the X11 root window down to a single X11 window.
Definition: data.h:591
void con_mark(Con *con, const char *mark, mark_mode_t mode)
Assigns a mark to the container.
Definition: con.c:679
adjacent_t con_adjacent_borders(Con *con)
Returns adjacent borders of the window.
Definition: con.c:1616
void con_unmark(Con *con, const char *name)
Definition: con.c:709
Con * con_descend_focused(Con *con)
Returns the focused con inside this client, descending the tree as far as possible.
Definition: con.c:1458
int con_num_windows(Con *con)
Count the number of windows (i.e., leaf containers).
Definition: con.c:839
Rect con_border_style_rect(Con *con)
Returns a "relative" Rect which contains the amount of pixels that need to be added to the original R...
Definition: con.c:1565
Con * con_get_output(Con *con)
Gets the output container (first container with CT_OUTPUT in hierarchy) this node is on...
Definition: con.c:391
bool con_is_internal(Con *con)
Returns true if the container is internal, such as __i3_scratch.
Definition: con.c:502
void con_close(Con *con, kill_window_t kill_window)
Closes the given container.
Definition: con.c:259
Con * con_by_window_id(xcb_window_t window)
Returns the container with the given client window ID or NULL if no such container exists...
Definition: con.c:583
mark_mode_t
Definition: data.h:85
void con_detach(Con *con)
Detaches the given container from its current parent.
Definition: con.c:207
layout_t
Container layouts.
Definition: data.h:91
void con_mark_toggle(Con *con, const char *mark, mark_mode_t mode)
Toggles the mark on a container.
Definition: con.c:664
void con_move_to_output(Con *con, Output *output)
Moves the given container to the currently focused container on the visible workspace on the given ou...
Definition: con.c:1303
Con * con_get_next(Con *con, char way, orientation_t orientation)
Get the next/previous container in the specified orientation.
Definition: con.c:1421
orientation_t con_orientation(Con *con)
Returns the orientation of the given container (for stacked containers, vertical orientation is used ...
Definition: con.c:1317
void con_enable_fullscreen(Con *con, fullscreen_mode_t fullscreen_mode)
Enables fullscreen mode for the given container, if necessary.
Definition: con.c:963
bool con_is_leaf(Con *con)
Returns true when this node is a leaf node (has no children)
Definition: con.c:289
void con_free(Con *con)
Frees the specified container.
Definition: con.c:80
bool con_is_sticky(Con *con)
Returns whether the container or any of its children is sticky.
Definition: con.c:354
int con_border_style(Con *con)
Use this function to get a container’s border style.
Definition: con.c:1645
void con_update_parents_urgency(Con *con)
Make all parent containers urgent if con is urgent or clear the urgent flag of all parent containers ...
Definition: con.c:2084
Con * con_by_frame_id(xcb_window_t frame)
Returns the container with the given frame ID or NULL if no such container exists.
Definition: con.c:621
kill_window_t
parameter to specify whether tree_close_internal() and x_window_kill() should kill only this specific...
Definition: data.h:68
bool con_accepts_window(Con *con)
Returns true if this node accepts a window (if the node swallows windows, it might already have swall...
Definition: con.c:372
void con_force_split_parents_redraw(Con *con)
force parent split containers to be redrawn
Definition: con.c:22
Con * con_next_focused(Con *con)
Returns the container which will be focused next when the given container is not available anymore...
Definition: con.c:1352
bool con_is_docked(Con *con)
Returns true if the container is a docked container.
Definition: con.c:520
void con_fix_percent(Con *con)
Updates the percent attribute of the children of the given container.
Definition: con.c:861
An Output is a physical output on your graphics driver.
Definition: data.h:366
Con * con_get_fullscreen_con(Con *con, fullscreen_mode_t fullscreen_mode)
Returns the first fullscreen node below this node.
Definition: con.c:454
adjacent_t
describes if the window is adjacent to the output (physical screen) edges.
Definition: data.h:73
void con_move_to_workspace(Con *con, Con *workspace, bool fix_coordinates, bool dont_warp, bool ignore_focus)
Moves the given container to the currently focused container on the given workspace.
Definition: con.c:1285
Con * con_get_workspace(Con *con)
Gets the workspace container this node is on.
Definition: con.c:405
fullscreen_mode_t
Fullscreen modes.
Definition: data.h:576
bool con_is_hidden(Con *con)
This will only return true for containers which have some parent with a tabbed / stacked parent of wh...
Definition: con.c:332
Con * con_descend_direction(Con *con, direction_t direction)
Definition: con.c:1499
Con * con_new_skeleton(Con *parent, i3Window *window)
Create a new container (and attach it to the given parent, if not NULL).
Definition: con.c:39
int con_num_visible_children(Con *con)
Returns the number of visible non-floating children of this container.
Definition: con.c:817
char * con_get_tree_representation(Con *con)
Create a string representing the subtree under con.
Definition: con.c:2153
Rect con_minimum_size(Con *con)
Determines the minimum size of the given con by looking at its children (for split/stacked/tabbed con...
Definition: con.c:1942
A "match" is a data structure which acts like a mask or expression to match certain windows or not...
Definition: data.h:483
int con_num_children(Con *con)
Returns the number of children of this container.
Definition: con.c:802
Con * con_parent_with_orientation(Con *con, orientation_t orientation)
Searches parents of the given &#39;con&#39; until it reaches one with the specified &#39;orientation&#39;.
Definition: con.c:417
orientation_t
Definition: data.h:59
Con * con_descend_tiling_focused(Con *con)
Returns the focused con inside this client, descending the tree as far as possible.
Definition: con.c:1473
i3String * con_parse_title_format(Con *con)
Returns the window title considering the current title format.
Definition: con.c:2216
bool con_is_split(Con *con)
Returns true if a container should be considered split.
Definition: con.c:313
bool con_has_children(Con *con)
Returns true if this node has regular or floating children.
Definition: con.c:305
Con * con_inside_floating(Con *con)
Checks if the given container is either floating or inside some floating container.
Definition: con.c:535
bool con_has_mark(Con *con, const char *mark)
Returns true if and only if the given containers holds the mark.
Definition: con.c:648
bool con_has_urgent_child(Con *con)
Checks if the given container has an urgent child.
Definition: con.c:2063
Stores a rectangle, for example the size of a window, the child window etc.
Definition: data.h:148
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)...
Definition: con.c:297
Con * con_new(Con *parent, i3Window *window)
Definition: con.c:70
Con * con_for_window(Con *con, i3Window *window, Match **store_match)
Returns the first container below &#39;con&#39; which wants to swallow this window TODO: priority.
Definition: con.c:763
bool con_move_to_mark(Con *con, const char *mark)
Moves the given container to the given mark.
Definition: con.c:1229
void con_set_border_style(Con *con, int border_style, int border_width)
Sets the given border style on con, correctly keeping the position/size of a floating window...
Definition: con.c:1669
bool con_inside_focused(Con *con)
Checks if the given container is inside a focused container.
Definition: con.c:553
bool con_swap(Con *first, Con *second)
Swaps the two containers.
Definition: con.c:2260
bool con_fullscreen_permits_focusing(Con *con)
Returns true if changing the focus to con would be allowed considering the fullscreen focus constrain...
Definition: con.c:2016
void con_set_urgency(Con *con, bool urgent)
Set urgency flag to the container, all the parent containers and the workspace.
Definition: con.c:2112
void con_toggle_fullscreen(Con *con, int fullscreen_mode)
Toggles fullscreen mode for the given container.
Definition: con.c:909