aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/force_display_urgency_hint.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-20 19:37:27 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-21 10:28:07 +1000
commitc2ed3d8bd6e2ec12f2ce70d7e106c09a7078e91f (patch)
treea1b879569d663c4b95c49985a877b87628dfb10f /sway/commands/force_display_urgency_hint.c
parentMerge pull request #2318 from RedSoxFan/fix-output-wildcard (diff)
downloadsway-c2ed3d8bd6e2ec12f2ce70d7e106c09a7078e91f.tar.gz
sway-c2ed3d8bd6e2ec12f2ce70d7e106c09a7078e91f.tar.zst
sway-c2ed3d8bd6e2ec12f2ce70d7e106c09a7078e91f.zip
Implement force_display_urgency_hint
The directive sets the timeout before an urgent view becomes normal again after switching to it from another workspace. Also: * When an xwayland surface removes the urgent hint while the timer is active, we now ignore the request. This happens as soon as the view receives focus, so it was effectively making the timer pointless. * The timeout is now only applied when switching to it from another workspace.
Diffstat (limited to 'sway/commands/force_display_urgency_hint.c')
-rw-r--r--sway/commands/force_display_urgency_hint.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/sway/commands/force_display_urgency_hint.c b/sway/commands/force_display_urgency_hint.c
new file mode 100644
index 00000000..a25ffff8
--- /dev/null
+++ b/sway/commands/force_display_urgency_hint.c
@@ -0,0 +1,28 @@
1#include "log.h"
2#include "sway/commands.h"
3#include "sway/config.h"
4#include "sway/tree/arrange.h"
5#include "sway/tree/container.h"
6#include "sway/tree/view.h"
7#include "sway/tree/layout.h"
8
9struct cmd_results *cmd_force_display_urgency_hint(int argc, char **argv) {
10 struct cmd_results *error = NULL;
11 if ((error = checkarg(argc, "force_display_urgency_hint",
12 EXPECTED_AT_LEAST, 1))) {
13 return error;
14 }
15
16 char *err;
17 int timeout = (int)strtol(argv[0], &err, 10);
18 if (*err) {
19 if (strcmp(err, "ms") != 0) {
20 return cmd_results_new(CMD_INVALID, "force_display_urgency_hint",
21 "Expected 'force_display_urgency_hint <timeout> ms'");
22 }
23 }
24
25 config->urgent_timeout = timeout > 0 ? timeout : 0;
26
27 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
28}