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 
27 Con *con_new(Con *parent, i3Window *window);
28 
33 void con_free(Con *con);
34 
40 void con_focus(Con *con);
41 
46 void con_activate(Con *con);
47 
52 void con_close(Con *con, kill_window_t kill_window);
53 
58 bool con_is_leaf(Con *con);
59 
64 bool con_has_managed_window(Con *con);
65 
70 bool con_is_split(Con *con);
71 
77 bool con_is_hidden(Con *con);
78 
83 bool con_is_sticky(Con *con);
84 
89 bool con_has_children(Con *con);
90 
96 bool con_accepts_window(Con *con);
97 
103 Con *con_get_output(Con *con);
104 
109 Con *con_get_workspace(Con *con);
110 
117 
122 Con *con_get_fullscreen_con(Con *con, fullscreen_mode_t fullscreen_mode);
123 
131 
136 bool con_is_internal(Con *con);
137 
142 bool con_is_floating(Con *con);
143 
148 bool con_is_docked(Con *con);
149 
156 
161 bool con_inside_focused(Con *con);
162 
167 bool con_has_parent(Con *con, Con *parent);
168 
174 Con *con_by_window_id(xcb_window_t window);
175 
181 Con *con_by_con_id(long target);
182 
188 bool con_exists(Con *con);
189 
195 Con *con_by_frame_id(xcb_window_t frame);
196 
202 Con *con_by_mark(const char *mark);
203 
208 bool con_has_mark(Con *con, const char *mark);
209 
216 void con_mark_toggle(Con *con, const char *mark, mark_mode_t mode);
217 
222 void con_mark(Con *con, const char *mark, mark_mode_t mode);
223 
231 void con_unmark(Con *con, const char *name);
232 
238 Con *con_for_window(Con *con, i3Window *window, Match **store_match);
239 
245 Con **get_focus_order(Con *con);
246 
254 void set_focus_order(Con *con, Con **focus_order);
255 
260 int con_num_children(Con *con);
261 
267 int con_num_visible_children(Con *con);
268 
273 int con_num_windows(Con *con);
274 
285 void con_attach(Con *con, Con *parent, bool ignore_focus);
286 
291 void con_detach(Con *con);
292 
299 void con_fix_percent(Con *con);
300 
306 void con_toggle_fullscreen(Con *con, int fullscreen_mode);
307 
312 void con_enable_fullscreen(Con *con, fullscreen_mode_t fullscreen_mode);
313 
318 void con_disable_fullscreen(Con *con);
319 
340 void con_move_to_workspace(Con *con, Con *workspace, bool fix_coordinates,
341  bool dont_warp, bool ignore_focus);
342 
348 void con_move_to_output(Con *con, Output *output, bool fix_coordinates);
349 
357 bool con_move_to_output_name(Con *con, const char *name, bool fix_coordinates);
358 
363 bool con_move_to_mark(Con *con, const char *mark);
364 
372 
379 Con *con_next_focused(Con *con);
380 
386 Con *con_get_next(Con *con, char way, orientation_t orientation);
387 
395 
405 
412 Con *con_descend_direction(Con *con, direction_t direction);
413 
421 
427 
438 int con_border_style(Con *con);
439 
445 void con_set_border_style(Con *con, int border_style, int border_width);
446 
453 void con_set_layout(Con *con, layout_t layout);
454 
462 void con_toggle_layout(Con *con, const char *toggle_mode);
463 
470 
493 
498 bool con_has_urgent_child(Con *con);
499 
506 
511 void con_set_urgency(Con *con, bool urgent);
512 
517 char *con_get_tree_representation(Con *con);
518 
524 
530 
535 bool con_swap(Con *first, Con *second);
Con * con_inside_floating(Con *con)
Checks if the given container is either floating or inside some floating container.
Definition: con.c:566
void con_disable_fullscreen(Con *con)
Disables fullscreen mode for the given container, if necessary.
Definition: con.c:1100
int con_num_windows(Con *con)
Count the number of windows (i.e., leaf containers).
Definition: con.c:926
Con * con_by_mark(const char *mark)
Returns the container with the given mark or NULL if no such container exists.
Definition: con.c:665
void con_focus(Con *con)
Sets input focus to the given container.
Definition: con.c:223
int con_num_children(Con *con)
Returns the number of children of this container.
Definition: con.c:889
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:431
bool con_move_to_output_name(Con *con, const char *name, bool fix_coordinates)
Moves the given container to the currently focused container on the visible workspace on the output s...
Definition: con.c:1402
Con * con_descend_tiling_focused(Con *con)
Returns the focused con inside this client, descending the tree as far as possible.
Definition: con.c:1546
void con_set_urgency(Con *con, bool urgent)
Set urgency flag to the container, all the parent containers and the workspace.
Definition: con.c:2173
void con_toggle_fullscreen(Con *con, int fullscreen_mode)
Toggles fullscreen mode for the given container.
Definition: con.c:1000
adjacent_t con_adjacent_borders(Con *con)
Returns adjacent borders of the window.
Definition: con.c:1689
void con_activate(Con *con)
Sets input focus to the given container and raises it to the top.
Definition: con.c:264
bool con_inside_focused(Con *con)
Checks if the given container is inside a focused container.
Definition: con.c:584
void con_close(Con *con, kill_window_t kill_window)
Closes the given container.
Definition: con.c:273
bool con_swap(Con *first, Con *second)
Swaps the two containers.
Definition: con.c:2321
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:614
fullscreen_mode_t
Fullscreen modes.
Definition: data.h:615
An Output is a physical output on your graphics driver.
Definition: data.h:392
void set_focus_order(Con *con, Con **focus_order)
Clear the container&#39;s focus stack and re-add it using the provided container array.
Definition: con.c:865
orientation_t con_orientation(Con *con)
Returns the orientation of the given container (for stacked containers, vertical orientation is used ...
Definition: con.c:1422
layout_t
Container layouts.
Definition: data.h:91
bool con_has_mark(Con *con, const char *mark)
Returns true if and only if the given containers holds the mark.
Definition: con.c:679
void con_mark_toggle(Con *con, const char *mark, mark_mode_t mode)
Toggles the mark on a container.
Definition: con.c:695
void con_free(Con *con)
Frees the specified container.
Definition: con.c:80
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:1638
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:311
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:627
A "match" is a data structure which acts like a mask or expression to match certain windows or not...
Definition: data.h:519
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:794
int con_num_visible_children(Con *con)
Returns the number of visible non-floating children of this container.
Definition: con.c:904
Con * con_descend_focused(Con *con)
Returns the focused con inside this client, descending the tree as far as possible.
Definition: con.c:1531
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:2084
Con * con_get_next(Con *con, char way, orientation_t orientation)
Get the next/previous container in the specified orientation.
Definition: con.c:1494
bool con_is_sticky(Con *con)
Returns whether the container or any of its children is sticky.
Definition: con.c:368
void con_fix_percent(Con *con)
Updates the percent attribute of the children of the given container.
Definition: con.c:952
void con_unmark(Con *con, const char *name)
Removes marks from containers.
Definition: con.c:740
Stores a rectangle, for example the size of a window, the child window etc.
Definition: data.h:174
kill_window_t
parameter to specify whether tree_close_internal() and x_window_kill() should kill only this specific...
Definition: data.h:68
orientation_t
Definition: data.h:59
Con * con_descend_direction(Con *con, direction_t direction)
Returns the leftmost, rightmost, etc.
Definition: con.c:1572
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
void con_enable_fullscreen(Con *con, fullscreen_mode_t fullscreen_mode)
Enables fullscreen mode for the given container, if necessary.
Definition: con.c:1054
void con_attach(Con *con, Con *parent, bool ignore_focus)
Attaches the given container to the given parent.
Definition: con.c:199
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:1741
char * con_get_tree_representation(Con *con)
Create a string representing the subtree under con.
Definition: con.c:2214
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:2145
void con_move_to_output(Con *con, Output *output, bool fix_coordinates)
Moves the given container to the currently focused container on the visible workspace on the given ou...
Definition: con.c:1387
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:1453
void con_detach(Con *con)
Detaches the given container from its current parent.
Definition: con.c:207
int con_border_style(Con *con)
Use this function to get a container’s border style.
Definition: con.c:1718
struct _i3String i3String
Opaque data structure for storing strings.
Definition: libi3.h:48
A &#39;Window&#39; is a type which contains an xcb_window_t and all the related information (hints like _NET_...
Definition: data.h:427
bool con_has_urgent_child(Con *con)
Checks if the given container has an urgent child.
Definition: con.c:2124
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:1369
Con * con_get_workspace(Con *con)
Gets the workspace container this node is on.
Definition: con.c:419
Con * con_get_output(Con *con)
Gets the output container (first container with CT_OUTPUT in hierarchy) this node is on...
Definition: con.c:405
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:346
void con_force_split_parents_redraw(Con *con)
force parent split containers to be redrawn
Definition: con.c:22
bool con_is_docked(Con *con)
Returns true if the container is a docked container.
Definition: con.c:551
bool con_has_parent(Con *con, Con *parent)
Checks if the container has the given parent as an actual parent.
Definition: con.c:596
i3String * con_parse_title_format(Con *con)
Returns the window title considering the current title format.
Definition: con.c:2277
A &#39;Con&#39; represents everything from the X11 root window down to a single X11 window.
Definition: data.h:630
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:652
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:386
void con_mark(Con *con, const char *mark, mark_mode_t mode)
Assigns a mark to the container.
Definition: con.c:710
Con * con_get_fullscreen_covering_ws(Con *ws)
Returns the fullscreen node that covers the given workspace if it exists.
Definition: con.c:518
bool con_is_split(Con *con)
Returns true if a container should be considered split.
Definition: con.c:327
bool con_move_to_mark(Con *con, const char *mark)
Moves the given container to the given mark.
Definition: con.c:1313
direction_t
Definition: data.h:55
bool con_has_children(Con *con)
Returns true if this node has regular or floating children.
Definition: con.c:319
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:2010
bool con_exists(Con *con)
Returns true if the given container (still) exists.
Definition: con.c:643
void con_set_layout(Con *con, layout_t layout)
This function changes the layout of a given container.
Definition: con.c:1783
Con * con_new(Con *parent, i3Window *window)
A wrapper for con_new_skeleton, to retain the old con_new behaviour.
Definition: con.c:70
bool con_is_floating(Con *con)
Returns true if the node is floating.
Definition: con.c:541
bool con_is_internal(Con *con)
Returns true if the container is internal, such as __i3_scratch.
Definition: con.c:533
Con * con_get_fullscreen_con(Con *con, fullscreen_mode_t fullscreen_mode)
Returns the first fullscreen node below this node.
Definition: con.c:468
void con_toggle_layout(Con *con, const char *toggle_mode)
This function toggles the layout of a given container.
Definition: con.c:1868
bool con_is_leaf(Con *con)
Returns true when this node is a leaf node (has no children)
Definition: con.c:303
mark_mode_t
Definition: data.h:85
Con ** get_focus_order(Con *con)
Iterate over the container&#39;s focus stack and return an array with the containers inside it...
Definition: con.c:845
adjacent_t
describes if the window is adjacent to the output (physical screen) edges.
Definition: data.h:73