diff options
author | 2016-09-01 21:39:08 -0500 | |
---|---|---|
committer | 2016-09-01 21:39:08 -0500 | |
commit | b374c35758777f98e5ddbe4b0dc43bd7c80f36d7 (patch) | |
tree | 04bb4cfc3da7d2e0de7fbc38db42f65c66d2df4c /sway/commands/orientation.c | |
parent | Merge pull request #874 from yohanesu75/ipc-client-fix (diff) | |
download | sway-b374c35758777f98e5ddbe4b0dc43bd7c80f36d7.tar.gz sway-b374c35758777f98e5ddbe4b0dc43bd7c80f36d7.tar.zst sway-b374c35758777f98e5ddbe4b0dc43bd7c80f36d7.zip |
refactor commands.c
Diffstat (limited to 'sway/commands/orientation.c')
-rw-r--r-- | sway/commands/orientation.c | 20 |
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 | |||
4 | struct 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 | } | ||