diff options
Diffstat (limited to 'include/commands.h')
-rw-r--r-- | include/commands.h | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/include/commands.h b/include/commands.h deleted file mode 100644 index cd0610f4..00000000 --- a/include/commands.h +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | #ifndef _SWAY_COMMANDS_H | ||
2 | #define _SWAY_COMMANDS_H | ||
3 | #include <stdbool.h> | ||
4 | #include <json-c/json.h> | ||
5 | #include <wlc/wlc.h> | ||
6 | #include "config.h" | ||
7 | |||
8 | /** | ||
9 | * Indicates the result of a command's execution. | ||
10 | */ | ||
11 | enum cmd_status { | ||
12 | CMD_SUCCESS, /**< The command was successful */ | ||
13 | CMD_FAILURE, /**< The command resulted in an error */ | ||
14 | CMD_INVALID, /**< Unknown command or parser error */ | ||
15 | CMD_DEFER, /**< Command execution deferred */ | ||
16 | // Config Blocks | ||
17 | CMD_BLOCK_END, | ||
18 | CMD_BLOCK_MODE, | ||
19 | CMD_BLOCK_BAR, | ||
20 | CMD_BLOCK_BAR_COLORS, | ||
21 | CMD_BLOCK_INPUT | ||
22 | }; | ||
23 | |||
24 | /** | ||
25 | * Stores the result of executing a command. | ||
26 | */ | ||
27 | struct cmd_results { | ||
28 | enum cmd_status status; | ||
29 | char *input; | ||
30 | /** | ||
31 | * Human friendly error message, or NULL on success | ||
32 | */ | ||
33 | char *error; | ||
34 | }; | ||
35 | |||
36 | /** | ||
37 | * Parse and handles a command. | ||
38 | */ | ||
39 | struct cmd_results *handle_command(char *command); | ||
40 | /** | ||
41 | * Parse and handles a command during config file loading. | ||
42 | * | ||
43 | * Do not use this under normal conditions. | ||
44 | */ | ||
45 | struct cmd_results *config_command(char *command, enum cmd_status block); | ||
46 | |||
47 | /** | ||
48 | * Allocates a cmd_results object. | ||
49 | */ | ||
50 | struct cmd_results *cmd_results_new(enum cmd_status status, const char* input, const char *error, ...); | ||
51 | /** | ||
52 | * Frees a cmd_results object. | ||
53 | */ | ||
54 | void free_cmd_results(struct cmd_results *results); | ||
55 | /** | ||
56 | * Serializes cmd_results to a JSON string. | ||
57 | * | ||
58 | * Free the JSON string later on. | ||
59 | */ | ||
60 | const char *cmd_results_to_json(struct cmd_results *results); | ||
61 | |||
62 | void remove_view_from_scratchpad(swayc_t *); | ||
63 | |||
64 | #endif | ||