aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/smart_gaps.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-06-11 11:03:43 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-06-11 11:03:43 +1000
commit9e96cfd310c4e5dc60f07d772e60b139ff7dc448 (patch)
tree9961c8705208b2f127133f0533bd305a6f75015e /sway/commands/smart_gaps.c
parentRefactor everything that needs to arrange windows (diff)
parentMerge pull request #2124 from emersion/drag-icons (diff)
downloadsway-9e96cfd310c4e5dc60f07d772e60b139ff7dc448.tar.gz
sway-9e96cfd310c4e5dc60f07d772e60b139ff7dc448.tar.zst
sway-9e96cfd310c4e5dc60f07d772e60b139ff7dc448.zip
Merge remote-tracking branch 'upstream/master' into atomic
Diffstat (limited to 'sway/commands/smart_gaps.c')
-rw-r--r--sway/commands/smart_gaps.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/sway/commands/smart_gaps.c b/sway/commands/smart_gaps.c
new file mode 100644
index 00000000..f687e78e
--- /dev/null
+++ b/sway/commands/smart_gaps.c
@@ -0,0 +1,29 @@
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 } else if (strcmp(argv[0], "off") == 0) {
20 config->smart_gaps = false;
21 } else {
22 return cmd_results_new(CMD_INVALID, "smart_gaps",
23 "Expected 'smart_gaps <on|off>' ");
24 }
25
26 arrange_and_commit(&root_container);
27
28 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
29}