diff options
author | Nate Symer <nate@symer.io> | 2018-06-09 09:34:56 -0400 |
---|---|---|
committer | Nate Symer <nate@symer.io> | 2018-06-09 09:34:56 -0400 |
commit | 6a910b9ba5443aa31f7cc2468c943c2f9da4854b (patch) | |
tree | 24e4ea6634a734ed303c7aaf611df682adbf746c /sway/commands/smart_gaps.c | |
parent | Merge pull request #2123 from emersion/fix-disabled-outputs (diff) | |
download | sway-6a910b9ba5443aa31f7cc2468c943c2f9da4854b.tar.gz sway-6a910b9ba5443aa31f7cc2468c943c2f9da4854b.tar.zst sway-6a910b9ba5443aa31f7cc2468c943c2f9da4854b.zip |
Implement gaps (PR #2047)
Diffstat (limited to 'sway/commands/smart_gaps.c')
-rw-r--r-- | sway/commands/smart_gaps.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sway/commands/smart_gaps.c b/sway/commands/smart_gaps.c new file mode 100644 index 00000000..38700d65 --- /dev/null +++ b/sway/commands/smart_gaps.c | |||
@@ -0,0 +1,28 @@ | |||
1 | #include <string.h> | ||
2 | #include "sway/commands.h" | ||
3 | #include "sway/config.h" | ||
4 | #include "sway/tree/arrange.h" | ||
5 | #include "sway/tree/view.h" | ||
6 | #include "sway/tree/container.h" | ||
7 | #include "log.h" | ||
8 | #include "stringop.h" | ||
9 | |||
10 | struct cmd_results *cmd_smart_gaps(int argc, char **argv) { | ||
11 | struct cmd_results *error = checkarg(argc, "smart_gaps", EXPECTED_AT_LEAST, 1); | ||
12 | |||
13 | if (error) { | ||
14 | return error; | ||
15 | } | ||
16 | |||
17 | if (strcmp(argv[0], "on") == 0) { | ||
18 | config->smart_gaps = true; | ||
19 | arrange_root(); | ||
20 | } else if (strcmp(argv[0], "off") == 0) { | ||
21 | config->smart_gaps = false; | ||
22 | arrange_root(); | ||
23 | } else { | ||
24 | return cmd_results_new(CMD_INVALID, "smart_gaps", | ||
25 | "Expected 'smart_gaps <on|off>' "); | ||
26 | } | ||
27 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
28 | } | ||