aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--foot.info2
-rw-r--r--osc.c28
2 files changed, 30 insertions, 0 deletions
diff --git a/foot.info b/foot.info
index 16327ca2..3e74caf2 100644
--- a/foot.info
+++ b/foot.info
@@ -26,6 +26,8 @@ foot+base|foot base fragment,
it#8,
lines#24,
pairs#0x10000,
+ Cr=\E]112\007,
+ Cs=\E]12;%p1%s\007,
acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
bel=^G,
blink=\E[5m,
diff --git a/osc.c b/osc.c
index d327d376..0b1d04d9 100644
--- a/osc.c
+++ b/osc.c
@@ -502,6 +502,27 @@ osc_dispatch(struct terminal *term)
}
case 12: /* Set cursor color */
+
+ /* Client queried for current value */
+ if (strlen(string) == 1 && string[0] == '?') {
+ uint8_t r = (term->cursor_color.text >> 16) & 0xff;
+ uint8_t g = (term->cursor_color.text >> 8) & 0xff;
+ uint8_t b = (term->cursor_color.text >> 0) & 0xff;
+
+ char reply[32];
+ snprintf(reply, sizeof(reply), "\033]12;rgb:%02x/%02x/%02x\033\\", r, g, b);
+ term_to_slave(term, reply, strlen(reply));
+ break;
+ }
+
+ uint32_t color;
+ if (string[0] == '#' ? !parse_legacy_color(string, &color) : !parse_rgb(string, &color))
+ break;
+
+ LOG_INFO("change cursor color to %06x", color);
+
+ term->cursor_color.cursor = 1 << 31 | color;
+ render_refresh(term);
break;
case 30: /* Set tab title */
@@ -557,6 +578,13 @@ osc_dispatch(struct terminal *term)
render_refresh(term);
break;
+ case 112:
+ LOG_DBG("resetting cursor color");
+ term->cursor_color.text = term->default_cursor_color.text;
+ term->cursor_color.cursor = term->default_cursor_color.cursor;
+ render_refresh(term);
+ break;
+
case 555:
osc_flash(term);
break;