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 
19 Con *con_new_skeleton(Con *parent, i3Window *window);
20 
21 /* A wrapper for con_new_skeleton, to retain the old con_new behaviour
22  *
23  */
24 Con *con_new(Con *parent, i3Window *window);
25 
31 void con_focus(Con *con);
32 
37 void con_close(Con *con, kill_window_t kill_window);
38 
43 bool con_is_leaf(Con *con);
44 
49 bool con_has_managed_window(Con *con);
50 
55 bool con_is_split(Con *con);
56 
62 bool con_is_hidden(Con *con);
63 
68 bool con_is_sticky(Con *con);
69 
74 bool con_has_children(Con *con);
75 
81 bool con_accepts_window(Con *con);
82 
88 Con *con_get_output(Con *con);
89 
95 
102 
107 Con *con_get_fullscreen_con(Con *con, fullscreen_mode_t fullscreen_mode);
108 
113 bool con_is_internal(Con *con);
114 
119 bool con_is_floating(Con *con);
120 
125 bool con_is_docked(Con *con);
126 
133 
138 bool con_inside_focused(Con *con);
139 
145 Con *con_by_window_id(xcb_window_t window);
146 
152 Con *con_by_frame_id(xcb_window_t frame);
153 
159 Con *con_by_mark(const char *mark);
160 
165 bool con_has_mark(Con *con, const char *mark);
166 
173 void con_mark_toggle(Con *con, const char *mark, mark_mode_t mode);
174 
179 void con_mark(Con *con, const char *mark, mark_mode_t mode);
180 
181 /*
182  * Removes marks from containers.
183  * If con is NULL, all containers are considered.
184  * If name is NULL, this removes all existing marks.
185  * Otherwise, it will only remove the given mark (if it is present).
186  *
187  */
188 void con_unmark(Con *con, const char *name);
189 
195 Con *con_for_window(Con *con, i3Window *window, Match **store_match);
196 
201 int con_num_children(Con *con);
202 
213 void con_attach(Con *con, Con *parent, bool ignore_focus);
214 
219 void con_detach(Con *con);
220 
227 void con_fix_percent(Con *con);
228 
234 void con_toggle_fullscreen(Con *con, int fullscreen_mode);
235 
240 void con_enable_fullscreen(Con *con, fullscreen_mode_t fullscreen_mode);
241 
246 void con_disable_fullscreen(Con *con);
247 
268 void con_move_to_workspace(Con *con, Con *workspace, bool fix_coordinates,
269  bool dont_warp, bool ignore_focus);
270 
275 bool con_move_to_mark(Con *con, const char *mark);
276 
284 
291 Con *con_next_focused(Con *con);
292 
298 Con *con_get_next(Con *con, char way, orientation_t orientation);
299 
307 
317 
318 /*
319  * Returns the leftmost, rightmost, etc. container in sub-tree. For example, if
320  * direction is D_LEFT, then we return the rightmost container and if direction
321  * is D_RIGHT, we return the leftmost container. This is because if we are
322  * moving D_LEFT, and thus want the rightmost container.
323  */
324 Con *con_descend_direction(Con *con, direction_t direction);
325 
333 
339 
350 int con_border_style(Con *con);
351 
357 void con_set_border_style(Con *con, int border_style, int border_width);
358 
365 void con_set_layout(Con *con, layout_t layout);
366 
374 void con_toggle_layout(Con *con, const char *toggle_mode);
375 
382 
405 
410 bool con_has_urgent_child(Con *con);
411 
418 
423 void con_set_urgency(Con *con, bool urgent);
424 
429 char *con_get_tree_representation(Con *con);
430 
436 
Con * con_by_mark(const char *mark)
Returns the container with the given mark or NULL if no such container exists.
Definition: con.c:557
Con * con_inside_floating(Con *con)
Checks if the given container is either floating or inside some floating container.
Definition: con.c:500
bool con_has_mark(Con *con, const char *mark)
Returns true if and only if the given containers holds the mark.
Definition: con.c:571
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:1818
layout_t
Container layouts.
Definition: data.h:84
void con_mark(Con *con, const char *mark, mark_mode_t mode)
Assigns a mark to the container.
Definition: con.c:602
adjacent_t con_adjacent_borders(Con *con)
Returns adjacent borders of the window.
Definition: con.c:1458
Con * con_for_window(Con *con, i3Window *window, Match **store_match)
Returns the first container below 'con' which wants to swallow this window TODO: priority.
Definition: con.c:681
void con_disable_fullscreen(Con *con)
Disables fullscreen mode for the given container, if necessary.
Definition: con.c:881
void con_focus(Con *con)
Sets input focus to the given container.
Definition: con.c:198
void con_set_urgency(Con *con, bool urgent)
Set urgency flag to the container, all the parent containers and the workspace.
Definition: con.c:1907
void con_toggle_fullscreen(Con *con, int fullscreen_mode)
Toggles fullscreen mode for the given container.
Definition: con.c:781
bool con_is_internal(Con *con)
Returns true if the container is internal, such as __i3_scratch.
Definition: con.c:467
void con_unmark(Con *con, const char *name)
Definition: con.c:631
void con_close(Con *con, kill_window_t kill_window)
Closes the given container.
Definition: con.c:227
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:531
orientation_t
Definition: data.h:58
void con_attach(Con *con, Con *parent, bool ignore_focus)
Attaches the given container to the given parent.
Definition: con.c:174
Con * con_descend_focused(Con *con)
Returns the focused con inside this client, descending the tree as far as possible.
Definition: con.c:1306
void con_toggle_layout(Con *con, const char *toggle_mode)
This function toggles the layout of a given container.
Definition: con.c:1644
void con_mark_toggle(Con *con, const char *mark, mark_mode_t mode)
Toggles the mark on a container.
Definition: con.c:587
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:1413
Con * con_get_output(Con *con)
Gets the output container (first container with CT_OUTPUT in hierarchy) this node is on...
Definition: con.c:359
adjacent_t
describes if the window is adjacent to the output (physical screen) edges.
Definition: data.h:72
void con_detach(Con *con)
Detaches the given container from its current parent.
Definition: con.c:182
fullscreen_mode_t
Fullscreen modes.
Definition: data.h:530
Con * con_get_next(Con *con, char way, orientation_t orientation)
Get the next/previous container in the specified orientation.
Definition: con.c:1269
bool con_is_sticky(Con *con)
Returns whether the container or any of its children is sticky.
Definition: con.c:322
kill_window_t
parameter to specify whether tree_close_internal() and x_window_kill() should kill only this specific...
Definition: data.h:67
Stores a rectangle, for example the size of a window, the child window etc.
Definition: data.h:141
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:1886
bool con_is_leaf(Con *con)
Returns true when this node is a leaf node (has no children)
Definition: con.c:257
Con * con_get_workspace(Con *con)
Gets the workspace container this node is on.
Definition: con.c:373
direction_t
Definition: data.h:54
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:1201
int con_border_style(Con *con)
Use this function to get a container’s border style.
Definition: con.c:1487
A 'Window' is a type which contains an xcb_window_t and all the related information (hints like _NET_...
Definition: data.h:361
orientation_t con_orientation(Con *con)
Returns the orientation of the given container (for stacked containers, vertical orientation is used ...
Definition: con.c:1166
void con_enable_fullscreen(Con *con, fullscreen_mode_t fullscreen_mode)
Enables fullscreen mode for the given container, if necessary.
Definition: con.c:835
Con * con_get_fullscreen_con(Con *con, fullscreen_mode_t fullscreen_mode)
Returns the first fullscreen node below this node.
Definition: con.c:421
mark_mode_t
Definition: data.h:78
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:544
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:340
A 'Con' represents everything from the X11 root window down to a single X11 window.
Definition: data.h:544
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:1147
Con * con_parent_with_orientation(Con *con, orientation_t orientation)
Searches parenst of the given 'con' until it reaches one with the specified 'orientation'.
Definition: con.c:385
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:300
Con * con_descend_tiling_focused(Con *con)
Returns the focused con inside this client, descending the tree as far as possible.
Definition: con.c:1321
void con_fix_percent(Con *con)
Updates the percent attribute of the children of the given container.
Definition: con.c:736
bool con_is_split(Con *con)
Returns true if a container should be considered split.
Definition: con.c:281
struct _i3String i3String
Opaque data structure for storing strings.
Definition: libi3.h:40
int con_num_children(Con *con)
Returns the number of children of this container.
Definition: con.c:720
void con_force_split_parents_redraw(Con *con)
force parent split containers to be redrawn
Definition: con.c:23
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:38
bool con_is_docked(Con *con)
Returns true if the container is a docked container.
Definition: con.c:485
i3String * con_parse_title_format(Con *con)
Returns the window title considering the current title format.
Definition: con.c:2011
char * con_get_tree_representation(Con *con)
Create a string representing the subtree under con.
Definition: con.c:1948
bool con_has_children(Con *con)
Returns true if this node has regular or floating children.
Definition: con.c:273
bool con_inside_focused(Con *con)
Checks if the given container is inside a focused container.
Definition: con.c:518
A "match" is a data structure which acts like a mask or expression to match certain windows or not...
Definition: data.h:439
Con * con_descend_direction(Con *con, direction_t direction)
Definition: con.c:1347
bool con_is_floating(Con *con)
Returns true if the node is floating.
Definition: con.c:475
Con * con_new(Con *parent, i3Window *window)
Definition: con.c:69
bool con_move_to_mark(Con *con, const char *mark)
Moves the given container to the given mark.
Definition: con.c:1091
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:1511
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:1744
bool con_has_urgent_child(Con *con)
Checks if the given container has an urgent child.
Definition: con.c:1865
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:265
void con_set_layout(Con *con, layout_t layout)
This function changes the layout of a given container.
Definition: con.c:1553