summaryrefslogtreecommitdiffstats
path: root/sway/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 4d5018a0..6c24395f 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -61,6 +61,7 @@ static sway_cmd cmd_scratchpad;
61static sway_cmd cmd_set; 61static sway_cmd cmd_set;
62static sway_cmd cmd_split; 62static sway_cmd cmd_split;
63static sway_cmd cmd_splith; 63static sway_cmd cmd_splith;
64static sway_cmd cmd_splitt;
64static sway_cmd cmd_splitv; 65static sway_cmd cmd_splitv;
65static sway_cmd cmd_sticky; 66static sway_cmd cmd_sticky;
66static sway_cmd cmd_workspace; 67static sway_cmd cmd_workspace;
@@ -1340,6 +1341,13 @@ static struct cmd_results *cmd_split(int argc, char **argv) {
1340 _do_split(argc - 1, argv + 1, L_VERT); 1341 _do_split(argc - 1, argv + 1, L_VERT);
1341 } else if (strcasecmp(argv[0], "h") == 0 || strcasecmp(argv[0], "horizontal") == 0) { 1342 } else if (strcasecmp(argv[0], "h") == 0 || strcasecmp(argv[0], "horizontal") == 0) {
1342 _do_split(argc - 1, argv + 1, L_HORIZ); 1343 _do_split(argc - 1, argv + 1, L_HORIZ);
1344 } else if (strcasecmp(argv[0], "t") == 0 || strcasecmp(argv[0], "toggle") == 0) {
1345 swayc_t *focused = get_focused_container(&root_container);
1346 if (focused->parent->layout == L_VERT) {
1347 _do_split(argc - 1, argv + 1, L_HORIZ);
1348 } else {
1349 _do_split(argc - 1, argv + 1, L_VERT);
1350 }
1343 } else { 1351 } else {
1344 error = cmd_results_new(CMD_FAILURE, "split", 1352 error = cmd_results_new(CMD_FAILURE, "split",
1345 "Invalid split command (expected either horiziontal or vertical)."); 1353 "Invalid split command (expected either horiziontal or vertical).");
@@ -1356,6 +1364,15 @@ static struct cmd_results *cmd_splith(int argc, char **argv) {
1356 return _do_split(argc, argv, L_HORIZ); 1364 return _do_split(argc, argv, L_HORIZ);
1357} 1365}
1358 1366
1367static struct cmd_results *cmd_splitt(int argc, char **argv) {
1368 swayc_t *focused = get_focused_container(&root_container);
1369 if (focused->parent->layout == L_VERT) {
1370 return _do_split(argc, argv, L_HORIZ);
1371 } else {
1372 return _do_split(argc, argv, L_VERT);
1373 }
1374}
1375
1359static struct cmd_results *cmd_sticky(int argc, char **argv) { 1376static struct cmd_results *cmd_sticky(int argc, char **argv) {
1360 struct cmd_results *error = NULL; 1377 struct cmd_results *error = NULL;
1361 if (config->reading) return cmd_results_new(CMD_FAILURE, "sticky", "Can't be used in config file."); 1378 if (config->reading) return cmd_results_new(CMD_FAILURE, "sticky", "Can't be used in config file.");
@@ -1567,6 +1584,7 @@ static struct cmd_handler handlers[] = {
1567 { "set", cmd_set }, 1584 { "set", cmd_set },
1568 { "split", cmd_split }, 1585 { "split", cmd_split },
1569 { "splith", cmd_splith }, 1586 { "splith", cmd_splith },
1587 { "splitt", cmd_splitt },
1570 { "splitv", cmd_splitv }, 1588 { "splitv", cmd_splitv },
1571 { "sticky", cmd_sticky }, 1589 { "sticky", cmd_sticky },
1572 { "workspace", cmd_workspace }, 1590 { "workspace", cmd_workspace },