aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/smart_gaps.c
diff options
context:
space:
mode:
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}