This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository terminology.
View the commit online.
commit 3e67708a8d3352e5e956ae13428b3948b8bd7500
Author: Cedric BAIL <[email protected]>
AuthorDate: Sun Nov 8 22:12:18 2026 -0600
tymuxd: answer the background and cursor color queries
A program in a tymux session that asks for the background color with
OSC 11 ? (vim, neovim and fish do) got no reply and waited for its own
timeout: tymuxd has no termio object, so the parser found no widget to
read the color class from, and flagged a decoding error instead.
Answer from the default theme, like OSC 10 and OSC 4 already do with
the stub palette. The edje color class accessors are renamed to stubs
in the tymuxd build, the way the textgrid palette is. Setting the
colors stays a no-op, as for OSC 10.
---
src/bin/meson.build | 7 +++++--
src/bin/tymuxd_stubs.c | 47 +++++++++++++++++++++++++++++++++++++++++++++--
tests/tymux.py | 21 +++++++++++++++++++++
3 files changed, 71 insertions(+), 4 deletions(-)
diff --git a/src/bin/meson.build b/src/bin/meson.build
index 8295720c..4e5b718d 100644
--- a/src/bin/meson.build
+++ b/src/bin/meson.build
@@ -225,10 +225,13 @@ if host_os == 'linux'
'uri_decode.c', 'uri_decode.h',
simd_sources]
# With no textgrid to hold the palette, the escape sequence parser gets it
- # from tymuxd_stubs.c, to map true colors and answer color queries.
+ # from tymuxd_stubs.c, to map true colors and answer color queries; the
+ # same goes for the background and cursor colors.
tymuxd = executable('tymuxd',
tymuxd_sources,
- c_args: '-Devas_object_textgrid_palette_get=tymuxd_textgrid_palette_get',
+ c_args: ['-Devas_object_textgrid_palette_get=tymuxd_textgrid_palette_get',
+ '-Dedje_object_color_class_get=tymuxd_edje_object_color_class_get',
+ '-Dedje_object_color_class_set=tymuxd_edje_object_color_class_set'],
install: true,
include_directories: config_dir,
dependencies: terminology_dependencies)
diff --git a/src/bin/tymuxd_stubs.c b/src/bin/tymuxd_stubs.c
index 3032cf7c..31e0d2f7 100644
--- a/src/bin/tymuxd_stubs.c
+++ b/src/bin/tymuxd_stubs.c
@@ -48,16 +48,59 @@ termio_textgrid_get(const Evas_Object *obj EINA_UNUSED)
return NULL;
}
+/* The parser only hands these to edje_object_color_class_get() and
+ * edje_object_color_class_set(), which the build of tymuxd renames to the
+ * functions below: any non-NULL pointer does. */
+static char _color_holder;
+
Evas_Object *
termio_bg_get(const Evas_Object *obj EINA_UNUSED)
{
- return NULL;
+ return (Evas_Object *)&_color_holder;
}
Evas_Object *
termio_get_cursor(const Evas_Object *obj EINA_UNUSED)
{
- return NULL;
+ return (Evas_Object *)&_color_holder;
+}
+
+/* The colors of the default theme (data/themes/default/colors.edc). */
+Eina_Bool
+tymuxd_edje_object_color_class_get(const Evas_Object *obj EINA_UNUSED,
+ const char *color_class,
+ int *r, int *g, int *b, int *a,
+ int *r2 EINA_UNUSED, int *g2 EINA_UNUSED,
+ int *b2 EINA_UNUSED, int *a2 EINA_UNUSED,
+ int *r3 EINA_UNUSED, int *g3 EINA_UNUSED,
+ int *b3 EINA_UNUSED, int *a3 EINA_UNUSED)
+{
+ int gray;
+
+ if (!strcmp(color_class, "BG"))
+ gray = 32;
+ else if (!strcmp(color_class, "CURSOR"))
+ gray = 255;
+ else
+ return EINA_FALSE;
+ if (r) *r = gray;
+ if (g) *g = gray;
+ if (b) *b = gray;
+ if (a) *a = 255;
+ return EINA_TRUE;
+}
+
+Eina_Bool
+tymuxd_edje_object_color_class_set(Evas_Object *obj EINA_UNUSED,
+ const char *color_class EINA_UNUSED,
+ int r EINA_UNUSED, int g EINA_UNUSED,
+ int b EINA_UNUSED, int a EINA_UNUSED,
+ int r2 EINA_UNUSED, int g2 EINA_UNUSED,
+ int b2 EINA_UNUSED, int a2 EINA_UNUSED,
+ int r3 EINA_UNUSED, int g3 EINA_UNUSED,
+ int b3 EINA_UNUSED, int a3 EINA_UNUSED)
+{
+ return EINA_TRUE;
}
void
diff --git a/tests/tymux.py b/tests/tymux.py
index a7345d95..0974ff6a 100644
--- a/tests/tymux.py
+++ b/tests/tymux.py
@@ -234,6 +234,27 @@ def main():
check(re.search(rb"48;2;18;52;86m(\033\[[0-9;]*m)*BLU", a.out) is not None,
"true background colors are drawn as is")
+ # the emulated terminal answers color queries: the shell saves the reply
+ # to a file, as reading it back from the screen is not reliable
+ for number, name, gray in ((10, "foreground", "aaaa"),
+ (11, "background", "2020"),
+ (12, "cursor", "ffff")):
+ path = os.path.join(XDG, "reply%d" % number)
+ a.send("stty raw -echo min 0 time 20;"
+ " printf '\\033]%d;?\\007';"
+ " dd bs=1 count=24 of='%s' 2>/dev/null; stty sane\r"
+ % (number, path))
+ reply = b""
+ end = time.time() + 4
+ while len(reply) < 24 and time.time() < end:
+ a.idle(0.1)
+ if os.path.exists(path):
+ with open(path, "rb") as f:
+ reply = f.read()
+ check(reply == b"\033]%d;rgb:%s/%s/%s\007"
+ % (number, gray.encode(), gray.encode(), gray.encode()),
+ "the %s color query is answered" % name)
+
# fraktur and encircled turn letters into other characters: use
# characters they leave alone
for code, word, name in ((5, "BLK", "blink"), (6, "RPD", "rapid blink"),
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.