2018-07-20 11:37:27 +02:00
|
|
|
#include "sway/commands.h"
|
|
|
|
#include "sway/config.h"
|
2020-08-03 13:25:08 +02:00
|
|
|
#include <errno.h>
|
2018-07-20 11:37:27 +02:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2020-08-03 13:25:08 +02:00
|
|
|
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]'");
|
2018-07-20 11:37:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
config->urgent_timeout = timeout > 0 ? timeout : 0;
|
|
|
|
|
2019-01-11 00:27:21 +01:00
|
|
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
2018-07-20 11:37:27 +02:00
|
|
|
}
|