Merge pull request #421 from crondog/splittoggle

split toggle
master
Drew DeVault 9 years ago
commit f69d765bbe

@ -61,6 +61,7 @@ static sway_cmd cmd_scratchpad;
static sway_cmd cmd_set; static sway_cmd cmd_set;
static sway_cmd cmd_split; static sway_cmd cmd_split;
static sway_cmd cmd_splith; static sway_cmd cmd_splith;
static sway_cmd cmd_splitt;
static sway_cmd cmd_splitv; static sway_cmd cmd_splitv;
static sway_cmd cmd_sticky; static sway_cmd cmd_sticky;
static sway_cmd cmd_workspace; static sway_cmd cmd_workspace;
@ -1340,6 +1341,13 @@ static struct cmd_results *cmd_split(int argc, char **argv) {
_do_split(argc - 1, argv + 1, L_VERT); _do_split(argc - 1, argv + 1, L_VERT);
} else if (strcasecmp(argv[0], "h") == 0 || strcasecmp(argv[0], "horizontal") == 0) { } else if (strcasecmp(argv[0], "h") == 0 || strcasecmp(argv[0], "horizontal") == 0) {
_do_split(argc - 1, argv + 1, L_HORIZ); _do_split(argc - 1, argv + 1, L_HORIZ);
} else if (strcasecmp(argv[0], "t") == 0 || strcasecmp(argv[0], "toggle") == 0) {
swayc_t *focused = get_focused_container(&root_container);
if (focused->parent->layout == L_VERT) {
_do_split(argc - 1, argv + 1, L_HORIZ);
} else {
_do_split(argc - 1, argv + 1, L_VERT);
}
} else { } else {
error = cmd_results_new(CMD_FAILURE, "split", error = cmd_results_new(CMD_FAILURE, "split",
"Invalid split command (expected either horiziontal or vertical)."); "Invalid split command (expected either horiziontal or vertical).");
@ -1356,6 +1364,15 @@ static struct cmd_results *cmd_splith(int argc, char **argv) {
return _do_split(argc, argv, L_HORIZ); return _do_split(argc, argv, L_HORIZ);
} }
static struct cmd_results *cmd_splitt(int argc, char **argv) {
swayc_t *focused = get_focused_container(&root_container);
if (focused->parent->layout == L_VERT) {
return _do_split(argc, argv, L_HORIZ);
} else {
return _do_split(argc, argv, L_VERT);
}
}
static struct cmd_results *cmd_sticky(int argc, char **argv) { static struct cmd_results *cmd_sticky(int argc, char **argv) {
struct cmd_results *error = NULL; struct cmd_results *error = NULL;
if (config->reading) return cmd_results_new(CMD_FAILURE, "sticky", "Can't be used in config file."); 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[] = {
{ "set", cmd_set }, { "set", cmd_set },
{ "split", cmd_split }, { "split", cmd_split },
{ "splith", cmd_splith }, { "splith", cmd_splith },
{ "splitt", cmd_splitt },
{ "splitv", cmd_splitv }, { "splitv", cmd_splitv },
{ "sticky", cmd_sticky }, { "sticky", cmd_sticky },
{ "workspace", cmd_workspace }, { "workspace", cmd_workspace },

@ -163,8 +163,9 @@ Commands
Creates a substitution for _value_ that can be used with $_name_ in other Creates a substitution for _value_ that can be used with $_name_ in other
commands. commands.
**split** <vertical|v|horizontal|h>:: **split** <vertical|v|horizontal|h|toggle|t>::
Splits the current container, vertically or horizontally. Splits the current container, vertically or horizontally. If toggled then the
current container is split opposite to the parent container.
**splith**:: **splith**::
Equivalent to **split horizontal**. Equivalent to **split horizontal**.
@ -172,6 +173,9 @@ Commands
**splitv**:: **splitv**::
Equivalent to **split vertical**. Equivalent to **split vertical**.
**splitt**::
Equivalent to **split toggle**.
**sticky** <enable|disable|toggle>:: **sticky** <enable|disable|toggle>::
If enabled and the windows is floating it will always be present on the active If enabled and the windows is floating it will always be present on the active
workspace on that output. workspace on that output.

Loading…
Cancel
Save