blob: 61322a577b91a6f5fb0d8f47296f13f3f7ce19dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include <string.h>
#include "sway/commands.h"
#include "sway/config.h"
struct cmd_results *seat_cmd_xcursor_theme(int argc, char **argv) {
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "xcursor_theme", EXPECTED_AT_LEAST, 1)) ||
(error = checkarg(argc, "xcursor_theme", EXPECTED_AT_MOST, 2))) {
return error;
}
if (!config->handler_context.seat_config) {
return cmd_results_new(CMD_FAILURE, "No seat defined");
}
const char *theme_name = argv[0];
unsigned size = 24;
if (argc == 2) {
char *end;
size = strtoul(argv[1], &end, 10);
if (*end) {
return cmd_results_new(
CMD_INVALID, "Expected a positive integer size");
}
}
free(config->handler_context.seat_config->xcursor_theme.name);
config->handler_context.seat_config->xcursor_theme.name = strdup(theme_name);
config->handler_context.seat_config->xcursor_theme.size = size;
return cmd_results_new(CMD_SUCCESS, NULL);
}
|