summaryrefslogtreecommitdiffstats
path: root/sway/commands/orientation.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/orientation.c')
-rw-r--r--sway/commands/orientation.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/sway/commands/orientation.c b/sway/commands/orientation.c
new file mode 100644
index 00000000..b1fc328d
--- /dev/null
+++ b/sway/commands/orientation.c
@@ -0,0 +1,20 @@
1#include <string.h>
2#include "commands.h"
3
4struct cmd_results *cmd_orientation(int argc, char **argv) {
5 struct cmd_results *error = NULL;
6 if (!config->reading) return cmd_results_new(CMD_FAILURE, "orientation", "Can only be used in config file.");
7 if ((error = checkarg(argc, "orientation", EXPECTED_EQUAL_TO, 1))) {
8 return error;
9 }
10 if (strcasecmp(argv[0], "horizontal") == 0) {
11 config->default_orientation = L_HORIZ;
12 } else if (strcasecmp(argv[0], "vertical") == 0) {
13 config->default_orientation = L_VERT;
14 } else if (strcasecmp(argv[0], "auto") == 0) {
15 // Do nothing
16 } else {
17 return cmd_results_new(CMD_INVALID, "orientation", "Expected 'orientation <horizontal|vertical|auto>'");
18 }
19 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
20}