aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/focus_on_window_activation.c
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-09-02 15:03:58 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-09-02 18:20:34 +1000
commitf057a0195ee79dfcaeddbcab026c06e310998c75 (patch)
tree5c09cc286ae3a6d852341a0ae4796d28bb6155b0 /sway/commands/focus_on_window_activation.c
parent159edc6d13db42b15b28c7ea58cdf2371d29297d (diff)
Implement focus_on_window_activation
Depends on https://github.com/swaywm/wlroots/pull/1223
Diffstat (limited to 'sway/commands/focus_on_window_activation.c')
-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);
+}