]> git.sur5r.net Git - i3/i3/commitdiff
Restrict 'resize' command to left/right for horizontal cons, up/down for vertical...
authorMichael Stapelberg <michael@stapelberg.de>
Mon, 5 Sep 2011 20:36:04 +0000 (22:36 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Mon, 5 Sep 2011 20:36:04 +0000 (22:36 +0200)
This makes the interface much clearer and avoids confusion about which key to
press in which situation.

src/cmdparse.y

index 51e0f7bc776487ff597db6feb1389bcf5598456a..72ffae6a5134796f8eed6978307347f5f2b16fc2 100644 (file)
@@ -857,6 +857,17 @@ resize:
             double percentage = 1.0 / children;
             LOG("default percentage = %f\n", percentage);
 
+            orientation_t orientation = current->parent->orientation;
+
+            if ((orientation == HORIZ &&
+                 (direction == TOK_UP || direction == TOK_DOWN)) ||
+                (orientation == VERT &&
+                 (direction == TOK_LEFT || direction == TOK_RIGHT))) {
+                LOG("You cannot resize in that direction. Your focus is in a %s split container currently.\n",
+                    (orientation == HORIZ ? "horizontal" : "vertical"));
+                break;
+            }
+
             if (direction == TOK_UP || direction == TOK_LEFT) {
                 other = TAILQ_PREV(current, nodes_head, nodes);
             } else {
@@ -864,7 +875,7 @@ resize:
             }
             if (other == TAILQ_END(workspaces)) {
                 LOG("No other container in this direction found, cannot resize.\n");
-                return 0;
+                break;
             }
             LOG("other->percent = %f\n", other->percent);
             LOG("current->percent before = %f\n", current->percent);