aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/focus_on_window_activation.c
blob: 2163fc5902f7d6ae10fd7649f88cc3f01c372586 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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,
				"Expected "
				"'focus_on_window_activation smart|urgent|focus|none'");
	}

	return cmd_results_new(CMD_SUCCESS, NULL);
}