2 #define I3__FILE__ "scratchpad.c"
22 if (con->
type == CT_WORKSPACE) {
23 LOG(
"'move scratchpad' used on a workspace \"%s\". Calling it "
24 "recursively on all windows on this workspace.\n",
35 DLOG(
"should move con %p to __i3_scratch\n", con);
39 DLOG(
"This window is already on __i3_scratch.\n");
54 if (maybe_floating_con == NULL) {
58 con = maybe_floating_con;
69 DLOG(
"This window was never used as a scratchpad before.\n");
70 if (con == maybe_floating_con) {
71 DLOG(
"It was in floating mode before, set scratchpad state to changed.\n");
74 DLOG(
"It was in tiling mode before, set scratchpad state to fresh.\n");
90 DLOG(
"should show scratchpad window %p\n", con);
100 DLOG(
"Focused window is a scratchpad window, hiding it.\n");
111 if (fs && fs->
type != CT_WORKSPACE) {
119 TAILQ_FOREACH (walk_con, &(focused_ws->floating_head), floating_windows) {
123 DLOG(
"Found an unfocused scratchpad window on this workspace\n");
124 DLOG(
"Focusing it: %p\n", walk_con);
139 if (!con && walk_ws &&
143 DLOG(
"Found a visible scratchpad window on another workspace,\n");
144 DLOG(
"moving it to this workspace: con = %p\n", walk_con);
153 DLOG(
"Window is not in the scratchpad, doing nothing.\n");
164 current != __i3_scratch) {
167 if (current == active) {
168 DLOG(
"Window is a scratchpad window, hiding it.\n");
181 LOG(
"You don't have any scratchpad windows yet.\n");
182 LOG(
"Use 'move scratchpad' to move a window to the scratchpad.\n");
196 DLOG(
"Adjusting size of this window.\n");
209 if (current != active) {
221 static int _gcd(
const int m,
const int n) {
224 return _gcd(n, (m % n));
238 static int _lcm(
const int m,
const int n) {
239 const int o =
_gcd(m, n);
240 return ((m * n) / o);
254 DLOG(
"Current resolution: (%d, %d) %d x %d\n",
261 if (output == __i3_output)
263 DLOG(
"output %s's resolution: (%d, %d) %d x %d\n",
266 if (new_width == -1) {
277 DLOG(
"new width = %d, new height = %d\n",
278 new_width, new_height);
284 if (memcmp(&old_rect, &new_rect,
sizeof(
Rect)) == 0) {
285 DLOG(
"Scratchpad size unchanged.\n");
289 DLOG(
"Fixing coordinates of scratchpad windows\n");
291 TAILQ_FOREACH (con, &(__i3_scratch->floating_head), floating_windows) {
enum Con::@20 scratchpad_state
void scratchpad_move(Con *con)
Moves the specified window to the __i3_scratch workspace, making it floating and setting the appropri...
Con * con_get_workspace(Con *con)
Gets the workspace container this node is on.
Stores a rectangle, for example the size of a window, the child window etc.
void workspace_show(Con *workspace)
Switches to the given workspace.
Con * con_descend_focused(Con *con)
Returns the focused con inside this client, descending the tree as far as possible.
struct all_cons_head all_cons
void con_move_to_workspace(Con *con, Con *workspace, bool fix_coordinates, bool dont_warp)
Moves the given container to the currently focused container on the given workspace.
Con * con_descend_tiling_focused(Con *con)
Returns the focused con inside this client, descending the tree as far as possible.
#define TAILQ_FIRST(head)
#define TAILQ_NEXT(elm, field)
bool con_is_internal(Con *con)
Returns true if the container is internal, such as __i3_scratch.
static int _lcm(const int m, const int n)
void floating_check_size(Con *floating_con)
Called when a floating window is created or resized.
fullscreen_mode_t fullscreen_mode
void con_focus(Con *con)
Sets input focus to the given container.
void scratchpad_show(Con *con)
Either shows the top-most scratchpad window (con == NULL) or shows the specified con (if it is scratc...
A 'Con' represents everything from the X11 root window down to a single X11 window.
Con * workspace_get(const char *num, bool *created)
Returns a pointer to the workspace with the given number (starting at 0), creating the workspace if n...
void scratchpad_fix_resolution(void)
When starting i3 initially (and after each change to the connected outputs), this function fixes the ...
Con * con_get_output(Con *con)
Gets the output container (first container with CT_OUTPUT in hierarchy) this node is on...
Con * con_inside_floating(Con *con)
Checks if the given container is either floating or inside some floating container.
void floating_enable(Con *con, bool automatic)
Enables floating mode for the given container by detaching it from its parent, creating a new contain...
static int _gcd(const int m, const int n)
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...
#define TAILQ_FOREACH(var, head, field)
void con_toggle_fullscreen(Con *con, int fullscreen_mode)
Toggles fullscreen mode for the given container.