summaryrefslogtreecommitdiffstats
path: root/sway/commands/seat
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/seat')
-rw-r--r--sway/commands/seat/xcursor_theme.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/sway/commands/seat/xcursor_theme.c b/sway/commands/seat/xcursor_theme.c
new file mode 100644
index 00000000..202f35b9
--- /dev/null
+++ b/sway/commands/seat/xcursor_theme.c
@@ -0,0 +1,33 @@
1#define _POSIX_C_SOURCE 200809L
2#include <string.h>
3#include "sway/commands.h"
4#include "sway/config.h"
5
6struct cmd_results *seat_cmd_xcursor_theme(int argc, char **argv) {
7 struct cmd_results *error = NULL;
8 if ((error = checkarg(argc, "xcursor_theme", EXPECTED_AT_LEAST, 1)) ||
9 (error = checkarg(argc, "xcursor_theme", EXPECTED_AT_MOST, 2))) {
10 return error;
11 }
12 if (!config->handler_context.seat_config) {
13 return cmd_results_new(CMD_FAILURE, "No seat defined");
14 }
15
16 const char *theme_name = argv[0];
17 unsigned size = 24;
18
19 if (argc == 2) {
20 char *end;
21 size = strtoul(argv[1], &end, 10);
22 if (*end) {
23 return cmd_results_new(
24 CMD_INVALID, "Expected a positive integer size");
25 }
26 }
27
28 free(config->handler_context.seat_config->xcursor_theme.name);
29 config->handler_context.seat_config->xcursor_theme.name = strdup(theme_name);
30 config->handler_context.seat_config->xcursor_theme.size = size;
31
32 return cmd_results_new(CMD_SUCCESS, NULL);
33}