From e38ec79be15fe355bf50670bc9066210ae0ed211 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sat, 21 Dec 2024 06:52:00 +0100 Subject: osc: add option to disable OSC-52, partially or fully Closes #1867 --- config.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'config.c') diff --git a/config.c b/config.c index 7c4ac0d1..7f1ce055 100644 --- a/config.c +++ b/config.c @@ -1110,6 +1110,25 @@ parse_section_main(struct context *ctx) } } +static bool +parse_section_security(struct context *ctx) +{ + struct config *conf = ctx->conf; + const char *key = ctx->key; + + if (streq(key, "osc52")) { + _Static_assert(sizeof(conf->security.osc52) == sizeof(int), + "enum is not 32-bit"); + return value_to_enum( + ctx, + (const char *[]){"disabled", "copy-enabled", "paste-enabled", "enabled", NULL}, + (int *)&conf->security.osc52); + } else { + LOG_CONTEXTUAL_ERR("not a valid option: %s", key); + return false; + } +} + static bool parse_section_bell(struct context *ctx) { @@ -2742,6 +2761,7 @@ parse_key_value(char *kv, const char **section, const char **key, const char **v enum section { SECTION_MAIN, + SECTION_SECURITY, SECTION_BELL, SECTION_DESKTOP_NOTIFICATIONS, SECTION_SCROLLBACK, @@ -2769,6 +2789,7 @@ static const struct { const char *name; } section_info[] = { [SECTION_MAIN] = {&parse_section_main, "main"}, + [SECTION_SECURITY] = {&parse_section_security, "security"}, [SECTION_BELL] = {&parse_section_bell, "bell"}, [SECTION_DESKTOP_NOTIFICATIONS] = {&parse_section_desktop_notifications, "desktop-notifications"}, [SECTION_SCROLLBACK] = {&parse_section_scrollback, "scrollback"}, @@ -3154,6 +3175,9 @@ config_load(struct config *conf, const char *conf_path, .underline_thickness = {.pt = 0., .px = -1}, .strikeout_thickness = {.pt = 0., .px = -1}, .dpi_aware = false, + .security = { + .osc52 = OSC52_ENABLED, + }, .bell = { .urgent = false, .notify = false, -- cgit v1.3