blob: 3d432cba9ca59b87b10bb1c36df24d4017d429ab (
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
|
#include "sway/commands.h"
#include "sway/config.h"
#include <errno.h>
struct cmd_results *cmd_force_display_urgency_hint(int argc, char **argv) {
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "force_display_urgency_hint",
EXPECTED_AT_LEAST, 1))) {
return error;
}
errno = 0;
char *end;
int timeout = (int)strtol(argv[0], &end, 10);
if (errno || end == argv[0] || (*end && strcmp(end, "ms") != 0)) {
return cmd_results_new(CMD_INVALID, "timeout integer invalid");
}
if (argc > 1 && strcmp(argv[1], "ms") != 0) {
return cmd_results_new(CMD_INVALID,
"Expected 'force_display_urgency_hint <timeout> [ms]'");
}
config->urgent_timeout = timeout > 0 ? timeout : 0;
return cmd_results_new(CMD_SUCCESS, NULL);
}
|