aboutsummaryrefslogtreecommitdiff
path: root/sway/commands
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-09-02 21:41:24 +0200
committerGitHub <noreply@github.com>2018-09-02 21:41:24 +0200
commite438342157272f6a807ea28ef1b554e01530ead8 (patch)
treefb510fe69ef12a9de9d299fa1543c32b49a16e8e /sway/commands
parent159edc6d13db42b15b28c7ea58cdf2371d29297d (diff)
parent6fb03817c9d2bd29697a91f92d680b0c6a2c5996 (diff)
Merge pull request #2560 from RyanDwyer/focus-on-window-activation
Implement focus_on_window_activation
Diffstat (limited to 'sway/commands')
-rw-r--r--sway/commands/focus_on_window_activation.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/sway/commands/focus_on_window_activation.c b/sway/commands/focus_on_window_activation.c
new file mode 100644
index 00000000..1fb07918
--- /dev/null
+++ b/sway/commands/focus_on_window_activation.c
@@ -0,0 +1,25 @@
+#include "sway/commands.h"
+
+struct cmd_results *cmd_focus_on_window_activation(int argc, char **argv) {
+ struct cmd_results *error = NULL;
+ if ((error = checkarg(argc, "focus_on_window_activation",
+ EXPECTED_EQUAL_TO, 1))) {
+ return error;
+ }
+
+ if (strcmp(argv[0], "smart") == 0) {
+ config->focus_on_window_activation = FOWA_SMART;
+ } else if (strcmp(argv[0], "urgent") == 0) {
+ config->focus_on_window_activation = FOWA_URGENT;
+ } else if (strcmp(argv[0], "focus") == 0) {
+ config->focus_on_window_activation = FOWA_FOCUS;
+ } else if (strcmp(argv[0], "none") == 0) {
+ config->focus_on_window_activation = FOWA_NONE;
+ } else {
+ return cmd_results_new(CMD_INVALID, "focus_on_window_activation",
+ "Expected "
+ "'focus_on_window_activation smart|urgent|focus|none'");
+ }
+
+ return cmd_results_new(CMD_SUCCESS, NULL, NULL);
+}