diff options
Diffstat (limited to 'sway/commands/seat/hide_cursor.c')
-rw-r--r-- | sway/commands/seat/hide_cursor.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sway/commands/seat/hide_cursor.c b/sway/commands/seat/hide_cursor.c new file mode 100644 index 00000000..343573b5 --- /dev/null +++ b/sway/commands/seat/hide_cursor.c | |||
@@ -0,0 +1,29 @@ | |||
1 | #define _POSIX_C_SOURCE 200809L | ||
2 | #include <string.h> | ||
3 | #include "sway/commands.h" | ||
4 | #include "sway/config.h" | ||
5 | #include "sway/input/seat.h" | ||
6 | #include "stringop.h" | ||
7 | |||
8 | struct cmd_results *seat_cmd_hide_cursor(int argc, char **argv) { | ||
9 | struct cmd_results *error = NULL; | ||
10 | if ((error = checkarg(argc, "hide_cursor", EXPECTED_EQUAL_TO, 1))) { | ||
11 | return error; | ||
12 | } | ||
13 | if (!config->handler_context.seat_config) { | ||
14 | return cmd_results_new(CMD_FAILURE, "hide_cursor", "No seat defined"); | ||
15 | } | ||
16 | |||
17 | char *end; | ||
18 | int timeout = strtol(argv[0], &end, 10); | ||
19 | if (*end) { | ||
20 | return cmd_results_new(CMD_INVALID, "hide_cursor", | ||
21 | "Expected an integer timeout"); | ||
22 | } | ||
23 | if (timeout < 100 && timeout != 0) { | ||
24 | timeout = 100; | ||
25 | } | ||
26 | config->handler_context.seat_config->hide_cursor_timeout = timeout; | ||
27 | |||
28 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
29 | } | ||