swayfx/sway/commands/primary_selection.c
Reza Jelveh fb86ed6b05
feat: 1.9 merge (#277)
Co-authored-by: William McKinnon <contact@willmckinnon.com>
Co-authored-by: Erik Reider <35975961+ErikReider@users.noreply.github.com>
2024-04-15 01:39:41 -04:00

24 lines
656 B
C

#include <string.h>
#include <strings.h>
#include "sway/config.h"
#include "sway/commands.h"
#include "util.h"
struct cmd_results *cmd_primary_selection(int argc, char **argv) {
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "primary_selection", EXPECTED_EQUAL_TO, 1))) {
return error;
}
bool primary_selection = parse_boolean(argv[0], true);
if (config->reloading && config->primary_selection != primary_selection) {
return cmd_results_new(CMD_FAILURE,
"primary_selection can only be enabled/disabled at launch");
}
config->primary_selection = parse_boolean(argv[0], true);
return cmd_results_new(CMD_SUCCESS, NULL);
}