Implement stack-limit for further defining how stack windows should look

Using this command, you can limit the amount of columns or rows for
a stacking container. This allows for better usage of screen estate
when using stacking containers with many clients.

Examples:
  i3-msg "stack-limit cols 2"
You will now have a stack window which has two columns of windows.
This commit is contained in:
Michael Stapelberg
2009-09-22 18:07:59 +02:00
parent d3752007ed
commit f4ec7fdfe9
5 changed files with 173 additions and 44 deletions

View File

@ -865,6 +865,30 @@ void parse_command(xcb_connection_t *conn, const char *command) {
return;
}
if (STARTS_WITH(command, "stack-limit ")) {
if (last_focused == NULL || client_is_floating(last_focused)) {
LOG("No container focused\n");
return;
}
const char *rest = command + strlen("stack-limit ");
if (strncmp(rest, "rows ", strlen("rows ")) == 0) {
last_focused->container->stack_limit = STACK_LIMIT_ROWS;
rest += strlen("rows ");
} else if (strncmp(rest, "cols ", strlen("cols ")) == 0) {
last_focused->container->stack_limit = STACK_LIMIT_COLS;
rest += strlen("cols ");
} else {
LOG("Syntax: stack-limit <cols|rows> <limit>\n");
return;
}
last_focused->container->stack_limit_value = atoi(rest);
if (last_focused->container->stack_limit_value == 0)
last_focused->container->stack_limit = STACK_LIMIT_NONE;
return;
}
/* Is it an <exit>? */
if (STARTS_WITH(command, "exit")) {
LOG("User issued exit-command, exiting without error.\n");