aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/seat
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-12-27 00:32:15 -0500
committerLibravatar emersion <contact@emersion.fr>2018-12-30 14:17:24 +0100
commit4d88c957905e7f6b2c8188d218ca22b3e6986fe4 (patch)
tree5f34ad1667607315cfbcb786ce71845a36595d82 /sway/commands/seat
parentVerify seat fallback settings on reload (diff)
downloadsway-4d88c957905e7f6b2c8188d218ca22b3e6986fe4.tar.gz
sway-4d88c957905e7f6b2c8188d218ca22b3e6986fe4.tar.zst
sway-4d88c957905e7f6b2c8188d218ca22b3e6986fe4.zip
hide_cursor: change to a seat subcommand
This makes hide_cursor a seat subcommand, which allows for seat specific timeouts.
Diffstat (limited to 'sway/commands/seat')
-rw-r--r--sway/commands/seat/hide_cursor.c29
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
8struct 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}