]> git.sur5r.net Git - i3/i3/blobdiff - src/commands.c
Implement stack-limit for further defining how stack windows should look
[i3/i3] / src / commands.c
index 5ca92b3185ee02f135296920804d26f25ce9c30b..191eb5bcb33e6a1695d5c5df3ea8ae7ebe48b29d 100644 (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");