20 if (con->
type == CT_WORKSPACE) {
21 LOG(
"'move scratchpad' used on a workspace \"%s\". Calling it "
22 "recursively on all windows on this workspace.\n",
33 DLOG(
"should move con %p to __i3_scratch\n", con);
37 DLOG(
"This window is already on __i3_scratch.\n");
50 if (maybe_floating_con == NULL) {
54 con = maybe_floating_con;
65 DLOG(
"This window was never used as a scratchpad before.\n");
66 if (con == maybe_floating_con) {
67 DLOG(
"It was in floating mode before, set scratchpad state to changed.\n");
70 DLOG(
"It was in tiling mode before, set scratchpad state to fresh.\n");
86 DLOG(
"should show scratchpad window %p\n", con);
96 DLOG(
"Focused window is a scratchpad window, hiding it.\n");
108 if (fs && fs->
type != CT_WORKSPACE) {
116 TAILQ_FOREACH (walk_con, &(focused_ws->floating_head), floating_windows) {
120 DLOG(
"Found an unfocused scratchpad window on this workspace\n");
121 DLOG(
"Focusing it: %p\n", walk_con);
136 if (!con && walk_ws &&
140 DLOG(
"Found a visible scratchpad window on another workspace,\n");
141 DLOG(
"moving it to this workspace: con = %p\n", walk_con);
151 DLOG(
"Window is not in the scratchpad, doing nothing.\n");
162 current != __i3_scratch) {
165 if (current == active) {
166 DLOG(
"Window is a scratchpad window, hiding it.\n");
179 LOG(
"You don't have any scratchpad windows yet.\n");
180 LOG(
"Use 'move scratchpad' to move a window to the scratchpad.\n");
194 DLOG(
"Adjusting size of this window.\n");
204 if (current != active) {
218static int _gcd(
const int m,
const int n) {
222 return _gcd(n, (m % n));
236static int _lcm(
const int m,
const int n) {
237 const int o =
_gcd(m, n);
238 return ((m * n) / o);
252 DLOG(
"Current resolution: (%d, %d) %d x %d\n",
259 if (output == __i3_output) {
262 DLOG(
"output %s's resolution: (%d, %d) %d x %d\n",
265 if (new_width == -1) {
276 DLOG(
"new width = %d, new height = %d\n",
277 new_width, new_height);
284 DLOG(
"Scratchpad size unchanged.\n");
288 DLOG(
"Fixing coordinates of scratchpad windows\n");
290 TAILQ_FOREACH (con, &(__i3_scratch->floating_head), floating_windows) {
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.
Con * con_get_workspace(Con *con)
Gets the workspace container this node is on.
Con * con_descend_tiling_focused(Con *con)
Returns the focused con inside this client, descending the tree as far as possible.
void con_disable_fullscreen(Con *con)
Disables fullscreen mode for the given container, if necessary.
Con * con_inside_floating(Con *con)
Checks if the given container is either floating or inside some floating container.
bool con_is_internal(Con *con)
Returns true if the container is internal, such as __i3_scratch.
void con_toggle_fullscreen(Con *con, int fullscreen_mode)
Toggles fullscreen mode for the given container.
void con_activate(Con *con)
Sets input focus to the given container and raises it to the top.
Con * con_get_output(Con *con)
Gets the output container (first container with CT_OUTPUT in hierarchy) this node is on.
Con * con_descend_focused(Con *con)
Returns the focused con inside this client, descending the tree as far as possible.
void floating_check_size(Con *floating_con, bool prefer_height)
Called when a floating window is created or resized.
void floating_center(Con *con, Rect rect)
Centers a floating con above the specified rect.
void floating_fix_coordinates(Con *con, Rect *old_rect, Rect *new_rect)
Fixes the coordinates of the floating window whenever the window gets reassigned to a different outpu...
bool floating_enable(Con *con, bool automatic)
Enables floating mode for the given container by detaching it from its parent, creating a new contain...
void scratchpad_fix_resolution(void)
When starting i3 initially (and after each change to the connected outputs), this function fixes the ...
bool scratchpad_show(Con *con)
Either shows the top-most scratchpad window (con == NULL) or shows the specified con (if it is scratc...
static int _lcm(const int m, const int n)
static int _gcd(const int m, const int n)
void scratchpad_move(Con *con)
Moves the specified window to the __i3_scratch workspace, making it floating and setting the appropri...
struct all_cons_head all_cons
bool rect_equals(Rect a, Rect b)
void workspace_show(Con *workspace)
Switches to the given workspace.
Con * workspace_get(const char *num)
Returns a pointer to the workspace with the given number (starting at 0), creating the workspace if n...
#define TAILQ_FOREACH(var, head, field)
#define TAILQ_FIRST(head)
#define TAILQ_NEXT(elm, field)
Stores a rectangle, for example the size of a window, the child window etc.
A 'Con' represents everything from the X11 root window down to a single X11 window.
enum Con::@20 scratchpad_state
fullscreen_mode_t fullscreen_mode