2022-03-16 23:22:41 +01:00
|
|
|
#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);
|
|
|
|
|
2024-02-05 11:07:33 +01:00
|
|
|
// config->primary_selection is reset to the previous value on reload in
|
|
|
|
// load_main_config()
|
2022-03-16 23:22:41 +01:00
|
|
|
if (config->reloading && config->primary_selection != primary_selection) {
|
|
|
|
return cmd_results_new(CMD_FAILURE,
|
|
|
|
"primary_selection can only be enabled/disabled at launch");
|
|
|
|
}
|
|
|
|
|
2024-02-05 11:05:52 +01:00
|
|
|
config->primary_selection = primary_selection;
|
2022-03-16 23:22:41 +01:00
|
|
|
|
|
|
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
|
|
|
}
|