This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch tytab
in repository terminology.
View the commit online.
commit f52c8b491a4a2254c55a7e32535b2cd4dfeb3b98
Author: [email protected] <[email protected]>
AuthorDate: Wed Jun 3 20:41:28 2026 -0600
feat: add shared tytab IPC protocol module
Add tytab_ipc.{c,h}: the session-hash helper and the EET data
descriptors for the tab request/reply messages, shared between the
terminology server and the tytab client. Wire the module into the
terminology build.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
---
src/bin/meson.build | 3 +-
src/bin/tytab_ipc.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++
src/bin/tytab_ipc.h | 31 ++++++++++++++++++
3 files changed, 124 insertions(+), 1 deletion(-)
diff --git a/src/bin/meson.build b/src/bin/meson.build
index f12f5d7a..c775b4a0 100644
--- a/src/bin/meson.build
+++ b/src/bin/meson.build
@@ -39,7 +39,8 @@ terminology_sources = ['private.h',
'extns.c', 'extns.h',
'gravatar.c', 'gravatar.h',
'tty_keys.h',
- 'sb.c', 'sb.h']
+ 'sb.c', 'sb.h',
+ 'tytab_ipc.c', 'tytab_ipc.h']
tybg_sources = ['tycommon.c', 'tycommon.h', 'tybg.c']
tyalpha_sources = ['tycommon.c', 'tycommon.h', 'tyalpha.c']
diff --git a/src/bin/tytab_ipc.c b/src/bin/tytab_ipc.c
new file mode 100644
index 00000000..3b2bf99b
--- /dev/null
+++ b/src/bin/tytab_ipc.c
@@ -0,0 +1,91 @@
+#include <Eina.h>
+#include <Eet.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "tytab_ipc.h"
+
+static Eet_Data_Descriptor *_tab_req_edd = NULL;
+static Eet_Data_Descriptor *_tab_rep_edd = NULL;
+
+char *
+tytab_ipc_hash_get(void)
+{
+ char buf[1024], hash[64];
+ const char *disp, *session, *xdg_session, *xdg_id, *xdg_seat, *xdg_vt;
+ int h;
+
+ disp = getenv("DISPLAY");
+ if (!disp) disp = "-unknown-";
+ session = getenv("DBUS_SESSION_BUS_ADDRESS");
+ if (!session) session = ":unknown:";
+ xdg_session = getenv("XDG_SESSION_COOKIE");
+ if (!xdg_session) xdg_session = "/unknown/";
+ xdg_id = getenv("XDG_SESSION_ID");
+ if (!xdg_id) xdg_id = "=unknown=";
+ xdg_seat = getenv("XDG_SEAT");
+ if (!xdg_seat) xdg_seat = "@unknown@";
+ xdg_vt = getenv("XDG_VTNR");
+ if (!xdg_vt) xdg_vt = "!unknown!";
+ snprintf(buf, sizeof(buf), "%s.%s.%s.%s.%s.%s",
+ disp, session, xdg_session,
+ xdg_id, xdg_seat, xdg_vt);
+ h = eina_hash_superfast(buf, strlen(buf));
+ snprintf(hash, sizeof(hash), "terminology-%08x", (unsigned int)h);
+ return strdup(hash);
+}
+
+void
+tytab_ipc_eet_init(void)
+{
+ Eet_Data_Descriptor_Class eddc;
+
+ eet_eina_stream_data_descriptor_class_set(&eddc, sizeof(eddc),
+ "tab_req",
+ sizeof(Ipc_Tab_Request));
+ _tab_req_edd = eet_data_descriptor_stream_new(&eddc);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_tab_req_edd, Ipc_Tab_Request,
+ "term_id", term_id, EET_T_UINT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_tab_req_edd, Ipc_Tab_Request,
+ "name", name, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_tab_req_edd, Ipc_Tab_Request,
+ "cmd", cmd, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_tab_req_edd, Ipc_Tab_Request,
+ "direction", direction, EET_T_STRING);
+
+ eet_eina_stream_data_descriptor_class_set(&eddc, sizeof(eddc),
+ "tab_rep",
+ sizeof(Ipc_Tab_Reply));
+ _tab_rep_edd = eet_data_descriptor_stream_new(&eddc);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_tab_rep_edd, Ipc_Tab_Reply,
+ "ok", ok, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_tab_rep_edd, Ipc_Tab_Reply,
+ "error", error, EET_T_STRING);
+}
+
+void
+tytab_ipc_eet_shutdown(void)
+{
+ if (_tab_req_edd)
+ {
+ eet_data_descriptor_free(_tab_req_edd);
+ _tab_req_edd = NULL;
+ }
+ if (_tab_rep_edd)
+ {
+ eet_data_descriptor_free(_tab_rep_edd);
+ _tab_rep_edd = NULL;
+ }
+}
+
+Eet_Data_Descriptor *
+tytab_ipc_req_edd_get(void)
+{
+ return _tab_req_edd;
+}
+
+Eet_Data_Descriptor *
+tytab_ipc_rep_edd_get(void)
+{
+ return _tab_rep_edd;
+}
diff --git a/src/bin/tytab_ipc.h b/src/bin/tytab_ipc.h
new file mode 100644
index 00000000..6786546b
--- /dev/null
+++ b/src/bin/tytab_ipc.h
@@ -0,0 +1,31 @@
+#ifndef TERMINOLOGY_TYTAB_IPC_H_
+#define TERMINOLOGY_TYTAB_IPC_H_ 1
+
+#include <Eet.h>
+
+#define TY_IPC_MAJOR_TAB 4
+#define TY_IPC_MINOR_TAB 2 /* 2: ok/error reply (was nonce_str in v1) */
+
+typedef struct _Ipc_Tab_Request Ipc_Tab_Request;
+struct _Ipc_Tab_Request
+{
+ unsigned int term_id;
+ char *name;
+ char *cmd;
+ char *direction; /* "l","r","t","b" or "" — Eet needs string, not char */
+};
+
+typedef struct _Ipc_Tab_Reply Ipc_Tab_Reply;
+struct _Ipc_Tab_Reply
+{
+ int ok; /* 1 = tab/split created, 0 = rejected */
+ char *error; /* human-readable reason when ok == 0, else NULL */
+};
+
+char *tytab_ipc_hash_get(void);
+void tytab_ipc_eet_init(void);
+void tytab_ipc_eet_shutdown(void);
+Eet_Data_Descriptor *tytab_ipc_req_edd_get(void);
+Eet_Data_Descriptor *tytab_ipc_rep_edd_get(void);
+
+#endif
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.