aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/layout.c
diff options
context:
space:
mode:
authorLibravatar D.B <thejan.2009@gmail.com>2016-10-10 20:44:09 +0200
committerLibravatar Drew DeVault <sir@cmpwn.com>2016-12-04 08:31:34 -0500
commit6fb4b6737a793672129bb621d48652cc5e42059e (patch)
tree58ef0b90988625bc0601bfc8b73d6927036ea08c /sway/commands/layout.c
parentMerge pull request #981 from SirCmpwn/security (diff)
downloadsway-6fb4b6737a793672129bb621d48652cc5e42059e.tar.gz
sway-6fb4b6737a793672129bb621d48652cc5e42059e.tar.zst
sway-6fb4b6737a793672129bb621d48652cc5e42059e.zip
add workspace_layout to container
Add swayc_change_layout function, which changes either layout or workspace_layout, depending on the container type.
Diffstat (limited to 'sway/commands/layout.c')
-rw-r--r--sway/commands/layout.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sway/commands/layout.c b/sway/commands/layout.c
index 05ab0a18..bef06cb2 100644
--- a/sway/commands/layout.c
+++ b/sway/commands/layout.c
@@ -22,10 +22,10 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
22 enum swayc_layouts old_layout = parent->layout; 22 enum swayc_layouts old_layout = parent->layout;
23 23
24 if (strcasecmp(argv[0], "default") == 0) { 24 if (strcasecmp(argv[0], "default") == 0) {
25 parent->layout = parent->prev_layout; 25 swayc_change_layout(parent, parent->prev_layout);
26 if (parent->layout == L_NONE) { 26 if (parent->layout == L_NONE) {
27 swayc_t *output = swayc_parent_by_type(parent, C_OUTPUT); 27 swayc_t *output = swayc_parent_by_type(parent, C_OUTPUT);
28 parent->layout = default_layout(output); 28 swayc_change_layout(parent, default_layout(output));
29 } 29 }
30 } else { 30 } else {
31 if (parent->layout != L_TABBED && parent->layout != L_STACKED) { 31 if (parent->layout != L_TABBED && parent->layout != L_STACKED) {
@@ -37,22 +37,22 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
37 parent = new_container(parent, L_TABBED); 37 parent = new_container(parent, L_TABBED);
38 } 38 }
39 39
40 parent->layout = L_TABBED; 40 swayc_change_layout(parent, L_TABBED);
41 } else if (strcasecmp(argv[0], "stacking") == 0) { 41 } else if (strcasecmp(argv[0], "stacking") == 0) {
42 if (parent->type != C_CONTAINER && !swayc_is_empty_workspace(parent)) { 42 if (parent->type != C_CONTAINER && !swayc_is_empty_workspace(parent)) {
43 parent = new_container(parent, L_STACKED); 43 parent = new_container(parent, L_STACKED);
44 } 44 }
45 45
46 parent->layout = L_STACKED; 46 swayc_change_layout(parent, L_STACKED);
47 } else if (strcasecmp(argv[0], "splith") == 0) { 47 } else if (strcasecmp(argv[0], "splith") == 0) {
48 parent->layout = L_HORIZ; 48 swayc_change_layout(parent, L_HORIZ);
49 } else if (strcasecmp(argv[0], "splitv") == 0) { 49 } else if (strcasecmp(argv[0], "splitv") == 0) {
50 parent->layout = L_VERT; 50 swayc_change_layout(parent, L_VERT);
51 } else if (strcasecmp(argv[0], "toggle") == 0 && argc == 2 && strcasecmp(argv[1], "split") == 0) { 51 } else if (strcasecmp(argv[0], "toggle") == 0 && argc == 2 && strcasecmp(argv[1], "split") == 0) {
52 if (parent->layout == L_HORIZ) { 52 if (parent->layout == L_HORIZ) {
53 parent->layout = L_VERT; 53 swayc_change_layout(parent, L_VERT);
54 } else { 54 } else {
55 parent->layout = L_HORIZ; 55 swayc_change_layout(parent, L_HORIZ);
56 } 56 }
57 } 57 }
58 } 58 }