summaryrefslogtreecommitdiffstats
path: root/sway/commands/smart_gaps.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-06-09 08:43:18 -0700
committerLibravatar GitHub <noreply@github.com>2018-06-09 08:43:18 -0700
commitd9fc381e0292519cccf2df6ea77a3356a2e621c7 (patch)
tree24e4ea6634a734ed303c7aaf611df682adbf746c /sway/commands/smart_gaps.c
parentMerge pull request #2123 from emersion/fix-disabled-outputs (diff)
parentImplement gaps (PR #2047) (diff)
downloadsway-d9fc381e0292519cccf2df6ea77a3356a2e621c7.tar.gz
sway-d9fc381e0292519cccf2df6ea77a3356a2e621c7.tar.zst
sway-d9fc381e0292519cccf2df6ea77a3356a2e621c7.zip
Merge pull request #2047 from natesymer/master
Implement Gaps
Diffstat (limited to 'sway/commands/smart_gaps.c')
-rw-r--r--sway/commands/smart_gaps.c28
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
10struct 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}