aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin <julien.voisin@dustri.org>2022-02-27 15:29:35 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-04-06 17:25:43 +0000
commit58a1ffe72483ffb52d617d2985851781e82a45b8 (patch)
tree5514c7ef7eea532a1f6d37e5a0f3af3502991308
parentosc: avoid unnecessary calls to strlen(3) (diff)
config: add tweak option to allow disabling sixels
Closes #950
-rw-r--r--CHANGELOG.md2
-rw-r--r--config.c4
-rw-r--r--config.h1
-rw-r--r--csi.c14
-rw-r--r--dcs.c3
-rw-r--r--doc/foot.ini.5.scd4
6 files changed, 26 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2ae45501..16108adf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -47,6 +47,8 @@
* Socket activation for `foot --server` and accompanying systemd unit files
* Support for [DECNKM](https://vt100.net/docs/vt510-rm/DECNKM.html), which
allows setting/saving/restoring/querying the keypad mode.
+* Sixel support can be disabled by setting `[tweak].sixel=no`
+ (https://codeberg.org/dnkl/foot/issues/950).
### Changed
diff --git a/config.c b/config.c
index b247f3e9..513d5032 100644
--- a/config.c
+++ b/config.c
@@ -2433,6 +2433,9 @@ parse_section_tweak(struct context *ctx)
else if (strcmp(key, "font-monospace-warn") == 0)
return value_to_bool(ctx, &conf->tweak.font_monospace_warn);
+ else if (strcmp(key, "sixel") == 0)
+ return value_to_bool(ctx, &conf->tweak.sixel);
+
else {
LOG_CONTEXTUAL_ERR("not a valid option: %s", key);
return false;
@@ -2974,6 +2977,7 @@ config_load(struct config *conf, const char *conf_path,
.box_drawing_base_thickness = 0.04,
.box_drawing_solid_shades = true,
.font_monospace_warn = true,
+ .sixel = true,
},
.notifications = tll_init(),
diff --git a/config.h b/config.h
index cf9ca3db..79311c86 100644
--- a/config.h
+++ b/config.h
@@ -316,6 +316,7 @@ struct config {
float box_drawing_base_thickness;
bool box_drawing_solid_shades;
bool font_monospace_warn;
+ bool sixel;
} tweak;
user_notifications_t notifications;
diff --git a/csi.c b/csi.c
index af3b2216..4277677c 100644
--- a/csi.c
+++ b/csi.c
@@ -795,8 +795,13 @@ csi_dispatch(struct terminal *term, uint8_t final)
*
* Note: tertiary DA responds with "FOOT".
*/
- static const char reply[] = "\033[?62;4;22c";
- term_to_slave(term, reply, sizeof(reply) - 1);
+ if (term->conf->tweak.sixel) {
+ static const char reply[] = "\033[?62;4;22c";
+ term_to_slave(term, reply, sizeof(reply) - 1);
+ } else {
+ static const char reply[] = "\033[?62;22c";
+ term_to_slave(term, reply, sizeof(reply) - 1);
+ }
break;
}
@@ -1418,6 +1423,11 @@ csi_dispatch(struct terminal *term, uint8_t final)
break;
case 'S': {
+ if (!term->conf->tweak.sixel) {
+ UNHANDLED();
+ break;
+ }
+
unsigned target = vt_param_get(term, 0, 0);
unsigned operation = vt_param_get(term, 1, 0);
diff --git a/dcs.c b/dcs.c
index 06ad60a9..fb4a14b6 100644
--- a/dcs.c
+++ b/dcs.c
@@ -420,6 +420,9 @@ dcs_hook(struct terminal *term, uint8_t final)
case 0:
switch (final) {
case 'q': {
+ if (!term->conf->tweak.sixel) {
+ break;
+ }
int p1 = vt_param_get(term, 0, 0);
int p2 = vt_param_get(term, 1,0);
int p3 = vt_param_get(term, 2, 0);
diff --git a/doc/foot.ini.5.scd b/doc/foot.ini.5.scd
index cc9daa74..fad39c09 100644
--- a/doc/foot.ini.5.scd
+++ b/doc/foot.ini.5.scd
@@ -1207,6 +1207,10 @@ any of these options.
Default: _512_. Maximum allowed: _2048_ (2GB).
+*sixel*
+ Boolean. When enabled, foot will process sixel images. Default: _yes_
+
+
# SEE ALSO
*foot*(1), *footclient*(1)