aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/primary_selection.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/primary_selection.c')
-rw-r--r--sway/commands/primary_selection.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/sway/commands/primary_selection.c b/sway/commands/primary_selection.c
new file mode 100644
index 00000000..585b079d
--- /dev/null
+++ b/sway/commands/primary_selection.c
@@ -0,0 +1,23 @@
1#include <string.h>
2#include <strings.h>
3#include "sway/config.h"
4#include "sway/commands.h"
5#include "util.h"
6
7struct cmd_results *cmd_primary_selection(int argc, char **argv) {
8 struct cmd_results *error = NULL;
9 if ((error = checkarg(argc, "primary_selection", EXPECTED_EQUAL_TO, 1))) {
10 return error;
11 }
12
13 bool primary_selection = parse_boolean(argv[0], true);
14
15 if (config->reloading && config->primary_selection != primary_selection) {
16 return cmd_results_new(CMD_FAILURE,
17 "primary_selection can only be enabled/disabled at launch");
18 }
19
20 config->primary_selection = parse_boolean(argv[0], true);
21
22 return cmd_results_new(CMD_SUCCESS, NULL);
23}