aboutsummaryrefslogtreecommitdiff
path: root/sway/commands
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-07-16 15:39:08 -0700
committerGitHub <noreply@github.com>2018-07-16 15:39:08 -0700
commitd6bd314dffb7385eec73de40f0fdd5775cd5941b (patch)
tree1cec389e971cda3e42766c07789d0f51c2d39715 /sway/commands
parent297e32126f1f8b27f51989b863e4ea1c9fce6a96 (diff)
parent255dc8bbb040c4f268f318bde86701227d82da3f (diff)
Merge pull request #2276 from RyanDwyer/urgency
Implement urgency base functionality
Diffstat (limited to 'sway/commands')
-rw-r--r--sway/commands/urgent.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/sway/commands/urgent.c b/sway/commands/urgent.c
new file mode 100644
index 00000000..d199858a
--- /dev/null
+++ b/sway/commands/urgent.c
@@ -0,0 +1,36 @@
+#include "log.h"
+#include "sway/commands.h"
+#include "sway/config.h"
+#include "sway/tree/arrange.h"
+#include "sway/tree/container.h"
+#include "sway/tree/view.h"
+#include "sway/tree/layout.h"
+
+struct cmd_results *cmd_urgent(int argc, char **argv) {
+ struct cmd_results *error = NULL;
+ if ((error = checkarg(argc, "urgent", EXPECTED_EQUAL_TO, 1))) {
+ return error;
+ }
+ struct sway_container *container =
+ config->handler_context.current_container;
+ if (container->type != C_VIEW) {
+ return cmd_results_new(CMD_INVALID, "urgent",
+ "Only views can be urgent");
+ }
+ struct sway_view *view = container->sway_view;
+
+ if (strcmp(argv[0], "enable") == 0) {
+ view_set_urgent(view, true);
+ } else if (strcmp(argv[0], "disable") == 0) {
+ view_set_urgent(view, false);
+ } else if (strcmp(argv[0], "allow") == 0) {
+ view->allow_request_urgent = true;
+ } else if (strcmp(argv[0], "deny") == 0) {
+ view->allow_request_urgent = false;
+ } else {
+ return cmd_results_new(CMD_INVALID, "urgent",
+ "Expected 'urgent <enable|disable|allow|deny>'");
+ }
+
+ return cmd_results_new(CMD_SUCCESS, NULL, NULL);
+}