aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-01-23 09:44:45 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-01-23 09:44:45 +0000
commite7b8f95af77d30c98c44f0fb0fd93285d8ca385b (patch)
tree195d14f2993b7d09231d614e60c22b3501d32dd7 /config.c
parentMerge branch 'mouse-button-encoding-of-button-6-7' (diff)
parentconfig: selection-target: space-optimize the static ‘value’ array (diff)
Merge branch 'selection-to-clipboard'
Closes #288
Diffstat (limited to 'config.c')
-rw-r--r--config.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/config.c b/config.c
index da55f8f8..81b329cf 100644
--- a/config.c
+++ b/config.c
@@ -673,6 +673,28 @@ parse_section_main(const char *key, const char *value, struct config *conf,
conf->notify.argv = argv;
}
+ else if (strcmp(key, "selection-target") == 0) {
+ static const char values[][12] = {
+ [SELECTION_TARGET_NONE] = "none",
+ [SELECTION_TARGET_PRIMARY] = "primary",
+ [SELECTION_TARGET_CLIPBOARD] = "clipboard",
+ [SELECTION_TARGET_BOTH] = "both",
+ };
+
+ for (size_t i = 0; i < ALEN(values); i++) {
+ if (strcasecmp(value, values[i]) == 0) {
+ conf->selection_target = i;
+ return true;
+ }
+ }
+
+ LOG_AND_NOTIFY_ERR(
+ "%s:%d: [default]: %s: invalid 'selection-target'; "
+ "must be one of 'none', 'primary', 'clipboard' or 'both",
+ path, lineno, value);
+ return false;
+ }
+
else {
LOG_AND_NOTIFY_ERR("%s:%u: [default]: %s: invalid key", path, lineno, key);
return false;
@@ -2127,6 +2149,7 @@ config_load(struct config *conf, const char *conf_path,
.render_worker_count = sysconf(_SC_NPROCESSORS_ONLN),
.server_socket_path = get_server_socket_path(),
.presentation_timings = false,
+ .selection_target = SELECTION_TARGET_PRIMARY,
.hold_at_exit = false,
.notify = {
.raw_cmd = NULL,