diff options
-rw-r--r-- | sway/commands/layout.c | 30 | ||||
-rw-r--r-- | sway/sway.5.txt | 20 |
2 files changed, 44 insertions, 6 deletions
diff --git a/sway/commands/layout.c b/sway/commands/layout.c index e6fa7ef1..5e2e8efd 100644 --- a/sway/commands/layout.c +++ b/sway/commands/layout.c | |||
@@ -74,6 +74,36 @@ struct cmd_results *cmd_layout(int argc, char **argv) { | |||
74 | parent = new_container(parent, L_AUTO_BOTTOM); | 74 | parent = new_container(parent, L_AUTO_BOTTOM); |
75 | } | 75 | } |
76 | swayc_change_layout(parent, L_AUTO_BOTTOM); | 76 | swayc_change_layout(parent, L_AUTO_BOTTOM); |
77 | } else if (strcasecmp(argv[0], "incnmaster") == 0) { | ||
78 | if ((error = checkarg(argc, "layout incnmaster", | ||
79 | EXPECTED_EQUAL_TO, 2))) { | ||
80 | return error; | ||
81 | } | ||
82 | int inc = (int) strtol(argv[1], NULL, 10); | ||
83 | swayc_t *container = get_focused_view(swayc_active_workspace()); | ||
84 | if (container && inc && | ||
85 | is_auto_layout(container->parent->layout) && | ||
86 | ((int)container->parent->nb_master + inc >= 0)) { | ||
87 | for (int i = container->parent->nb_master; | ||
88 | i >= 0 && i < container->parent->children->length && | ||
89 | i != (int) container->parent->nb_master + inc;) { | ||
90 | ((swayc_t *) container->parent->children->items[i])->height = -1; | ||
91 | ((swayc_t *) container->parent->children->items[i])->width = -1; | ||
92 | i += inc > 0 ? 1 : -1; | ||
93 | } | ||
94 | container->parent->nb_master += inc; | ||
95 | } | ||
96 | } else if ((strcasecmp(argv[0], "incncol") == 0) && argc ==2) { | ||
97 | if ((error = checkarg(argc, "layout incncol", | ||
98 | EXPECTED_EQUAL_TO, 2))) { | ||
99 | return error; | ||
100 | } | ||
101 | int inc = (int) strtol(argv[1], NULL, 10); | ||
102 | swayc_t *container = get_focused_view(swayc_active_workspace()); | ||
103 | if (container && inc && is_auto_layout(container->parent->layout) && | ||
104 | ((int)container->parent->nb_slave_groups + inc >= 1)) { | ||
105 | container->parent->nb_slave_groups += inc; | ||
106 | } | ||
77 | } | 107 | } |
78 | } | 108 | } |
79 | 109 | ||
diff --git a/sway/sway.5.txt b/sway/sway.5.txt index 1f25ce14..2fa5f32e 100644 --- a/sway/sway.5.txt +++ b/sway/sway.5.txt | |||
@@ -39,7 +39,7 @@ The following commands may only be used in the configuration file. | |||
39 | **set** <name> <value>:: | 39 | **set** <name> <value>:: |
40 | Sets variable $name to _value_. You can use the new variable in the arguments | 40 | Sets variable $name to _value_. You can use the new variable in the arguments |
41 | of future commands. | 41 | of future commands. |
42 | 42 | ||
43 | **orientation** <horizontal|vertical|auto>:: | 43 | **orientation** <horizontal|vertical|auto>:: |
44 | Sets the default container layout for tiled containers. | 44 | Sets the default container layout for tiled containers. |
45 | 45 | ||
@@ -62,11 +62,14 @@ They are expected to be used with **bindsym** or at runtime through **swaymsg**( | |||
62 | Make focused view floating, non-floating, or the opposite of what it is now. | 62 | Make focused view floating, non-floating, or the opposite of what it is now. |
63 | 63 | ||
64 | **focus** <direction>:: | 64 | **focus** <direction>:: |
65 | Direction may be one of _up_, _down_, _left_, _right_, _parent_, or _child_. | 65 | Direction may be one of _up_, _down_, _left_, _right_, _next_, _prev_, |
66 | The directional focus commands will move the focus in that direction. The parent | 66 | _parent_, or _child_. The directional focus commands will move the focus |
67 | focus command will change the focus to the parent of the currently focused | 67 | in that direction. The auto_next and auto_prev will focus the next, |
68 | container, which is useful, for example, to open a sibling of the parent | 68 | respectively previous, element in the current container if it is using |
69 | container, or to move the entire container around. | 69 | one of the _auto_ layouts. The parent focus command will change the |
70 | focus to the parent of the currently focused container, which is useful, | ||
71 | for example, to open a sibling of the parent container, or to move the | ||
72 | entire container around. | ||
70 | 73 | ||
71 | **focus** output <direction|name>:: | 74 | **focus** output <direction|name>:: |
72 | Direction may be one of _up_, _down_, _left_, _right_. The directional focus | 75 | Direction may be one of _up_, _down_, _left_, _right_. The directional focus |
@@ -84,6 +87,11 @@ They are expected to be used with **bindsym** or at runtime through **swaymsg**( | |||
84 | _splitv_, _toggle split_, _stacking_, _tabbed_, _auto_left_, _auto_right_, | 87 | _splitv_, _toggle split_, _stacking_, _tabbed_, _auto_left_, _auto_right_, |
85 | _auto_top, _auto_bottom_. | 88 | _auto_top, _auto_bottom_. |
86 | 89 | ||
90 | **layout** <incnmaster|incncol> <n>:: | ||
91 | Modify the number of master elements, respectively slave columns, in the | ||
92 | focused container. <n> can be a positive or negative integer. These commands | ||
93 | only have an effect if the focused container uses one of the "auto" layouts. | ||
94 | |||
87 | **move** <left|right|up|down>:: | 95 | **move** <left|right|up|down>:: |
88 | Moves the focused container _left_, _right_, _up_, or _down_. | 96 | Moves the focused container _left_, _right_, _up_, or _down_. |
89 | 97 | ||