This is an automated email from the git hooks/post-receive script.

git pushed a commit to reference refs/pull/36/head
in repository terminology.

View the commit online.

commit 4c29fc259caf18502430005f08421b6dc4b840b6
Author: [email protected] <[email protected]>
AuthorDate: Sun Mar 15 21:09:55 2026 -0600

    build: add tymux daemon scaffolding and Linux-only gates
    
    The tymux session recovery feature requires a headless daemon that can
    manage sessions without Elementary (the display/widget toolkit). This
    scaffolding:
    
    - Gates all tymux code behind `host_os == 'linux'` and `HAVE_TYMUX`
    - Builds a separate `tymuxd` executable linked against EFL core libs
      but not Elementary, preventing circular dependencies and reducing
      daemon footprint
    - Provides opaque type stubs in private.h for Elementary types that
      appear in termpty*/termiointernals source files (which are shared
      with the daemon)
    - Guards Elementary.h includes across all affected translation units,
      with fallback to EFl core headers when building for tymuxd
    - Adds stub implementations of display layer functions (termio,
      miniview, config) that the headless daemon doesn't call
    - Creates stub source files for tymux CLI tool, tymuxd daemon, and
      session management components
    
    This separation allows termpty/termiointernals logic to be reused in
    the headless daemon without pulling in GUI dependencies.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
---
 meson.build               |  24 +++++
 src/bin/backlog.c         |   2 +
 src/bin/colors.c          |   4 +
 src/bin/extns.c           |   2 +
 src/bin/meson.build       |  41 ++++++++
 src/bin/private.h         |  22 +++++
 src/bin/termio.h          |   2 +-
 src/bin/termiointernals.c |   2 +
 src/bin/termiointernals.h |   2 +-
 src/bin/termiolink.c      |   2 +
 src/bin/termpty.c         |   5 +-
 src/bin/termptydbl.c      |   2 +
 src/bin/termptyesc.c      |   2 +
 src/bin/termptyext.c      |   2 +
 src/bin/termptygfx.c      |   2 +
 src/bin/termptyops.c      |   2 +
 src/bin/termsession.c     |   2 +
 src/bin/termsession.h     |   3 +
 src/bin/tymux.c           |   7 ++
 src/bin/tymux_session.c   |   2 +
 src/bin/tymux_session.h   |   3 +
 src/bin/tymuxd.c          |  11 +++
 src/bin/tymuxd.h          |   3 +
 src/bin/tymuxd_stubs.c    | 234 ++++++++++++++++++++++++++++++++++++++++++++++
 24 files changed, 380 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index 780e94c7..7e11504d 100644
--- a/meson.build
+++ b/meson.build
@@ -38,6 +38,7 @@ if host_os == 'linux'
    config_data.set('_ALL_SOURCE', 1)
    config_data.set('_POSIX_SOURCE', 1)
    config_data.set('_POSIX_1_SOURCE', 1)
+   config_data.set('HAVE_TYMUX', 1)
 endif
 
 efl_version = '1.26.0'
@@ -58,7 +59,23 @@ efl_deps = ['edje',
             'efreet',
             'ecore-con',
             'ethumb_client']
+# tymuxd is a headless daemon: it needs the EFL core and codec libs but must
+# not link against Elementary (display/widget toolkit) or Emotion/Ethumb.
+tymuxd_efl_deps = ['edje',
+                   'eina',
+                   'eet',
+                   'evas',
+                   'ecore',
+                   'ecore-evas',
+                   'ecore-file',
+                   'ecore-input',
+                   'ecore-imf',
+                   'ecore-imf-evas',
+                   'ecore-ipc',
+                   'efreet',
+                   'ecore-con']
 terminology_dependencies = [ m_dep ]
+tymuxd_dependencies = [ m_dep ]
 edje_cc_path = ''
 eet_path = ''
 edj_targets = []
@@ -70,8 +87,10 @@ if get_option('nls') == true
   dep = dependency('intl', required: false)
   if dep.found()
     terminology_dependencies += dep
+    tymuxd_dependencies += dep
   else
     terminology_dependencies += cc.find_library('intl', required: false)
+    tymuxd_dependencies += cc.find_library('intl', required: false)
   endif
 endif
 
@@ -86,6 +105,11 @@ foreach efl_dep: efl_deps
   endif
 endforeach
 
+foreach efl_dep: tymuxd_efl_deps
+  dep = dependency(efl_dep, version: '>=' + efl_version)
+  tymuxd_dependencies += [dep]
+endforeach
+
 if cc.has_function('mkstemps')
   config_data.set('HAVE_MKSTEMPS', 1)
 endif
diff --git a/src/bin/backlog.c b/src/bin/backlog.c
index 6b687f49..a404d57c 100644
--- a/src/bin/backlog.c
+++ b/src/bin/backlog.c
@@ -1,5 +1,7 @@
 #include "private.h"
+#if !defined(BINARY_TYMUXD)
 #include <Elementary.h>
+#endif
 #include "termpty.h"
 #include "backlog.h"
 
diff --git a/src/bin/colors.c b/src/bin/colors.c
index 8949a8a5..10a7a311 100644
--- a/src/bin/colors.c
+++ b/src/bin/colors.c
@@ -1,6 +1,10 @@
 #include "private.h"
 #include <assert.h>
+#if !defined(BINARY_TYMUXD)
 #include <Elementary.h>
+#else
+#include <Eet.h>
+#endif
 #include "config.h"
 #include "colors.h"
 
diff --git a/src/bin/extns.c b/src/bin/extns.c
index fb99c1a0..22e8a9f6 100644
--- a/src/bin/extns.c
+++ b/src/bin/extns.c
@@ -1,5 +1,7 @@
 #include "private.h"
+#if !defined(BINARY_TYMUXD)
 #include <Elementary.h>
+#endif
 #include <stdio.h>
 
 const char *extn_img[] =
diff --git a/src/bin/meson.build b/src/bin/meson.build
index f12f5d7a..874d3805 100644
--- a/src/bin/meson.build
+++ b/src/bin/meson.build
@@ -128,6 +128,47 @@ executable('tysend',
            include_directories: config_dir,
            dependencies: terminology_dependencies)
 
+if host_os == 'linux'
+  terminology_sources += [
+      'termsrv.c', 'termsrv.h',
+      'termsession.c', 'termsession.h',
+  ]
+
+  tymuxd_sources = [
+      'tymuxd.c', 'tymuxd.h',
+      'tymux_session.c', 'tymux_session.h',
+      'termsrv.c', 'termsrv.h',
+      'termpty.c', 'termpty.h',
+      'termptyesc.c', 'termptyesc.h',
+      'termptyops.c', 'termptyops.h',
+      'termptydbl.c', 'termptydbl.h',
+      'termptyext.c', 'termptyext.h',
+      'termptygfx.c', 'termptygfx.h',
+      'termiointernals.c', 'termiointernals.h',
+      'backlog.c', 'backlog.h',
+      'sb.c', 'sb.h',
+      'utf8.c', 'utf8.h',
+      'colors.c', 'colors.h',
+      'md5.c', 'md5.h',
+      'utils.c', 'utils.h',
+      'extns.c', 'extns.h',
+      'tymuxd_stubs.c',
+  ]
+
+  executable('tymuxd',
+             tymuxd_sources,
+             c_args : ['-DBINARY_TYMUXD'],
+             install: true,
+             include_directories: config_dir,
+             dependencies : tymuxd_dependencies)
+
+  executable('tymux',
+             ['tymux.c'],
+             install: true,
+             include_directories: config_dir,
+             dependencies : [])
+endif
+
 if fuzzing
   executable('tyfuzz',
              tyfuzz_sources,
diff --git a/src/bin/private.h b/src/bin/private.h
index db3e5865..e38defb3 100644
--- a/src/bin/private.h
+++ b/src/bin/private.h
@@ -27,6 +27,28 @@ extern int terminology_starting_up;
 #if defined(BINARY_TYFUZZ) || defined(BINARY_TYTEST)
 #define EINA_LOG_LEVEL_MAXIMUM (-1)
 #endif
+
+/* When building the headless tymuxd daemon Elementary is not linked.
+ * Include the EFL core headers that Elementary would normally pull in
+ * transitively, then provide opaque stand-ins for the Elementary types
+ * that appear in termpty and termiointernals source files so those
+ * translation units compile without Elementary.h. */
+#if defined(BINARY_TYMUXD)
+# include <Eina.h>
+# include <Evas.h>
+# include <Ecore.h>
+# include <Ecore_Evas.h>
+# include <Ecore_IMF.h>
+# include <Ecore_IMF_Evas.h>
+typedef int Elm_Sel_Type;
+typedef int Elm_Sel_Format;
+typedef void (*Elm_Drop_Cb)(void *, void *, void *);
+typedef struct { void *data; int format; unsigned int len; } Elm_Selection_Data;
+# define ELM_SEL_TYPE_PRIMARY    0
+# define ELM_SEL_TYPE_CLIPBOARD  3
+# define ELM_SEL_FORMAT_TEXT     (1 << 1)
+# define ELM_SYS_NOTIFY_URGENCY_NORMAL 1
+#endif
 extern int _log_domain;
 
 #define CRITICAL(...) EINA_LOG_DOM_CRIT(_log_domain, __VA_ARGS__)
diff --git a/src/bin/termio.h b/src/bin/termio.h
index 9da9a9b9..0e16cd1d 100644
--- a/src/bin/termio.h
+++ b/src/bin/termio.h
@@ -5,7 +5,7 @@
 #include "main.h"
 #include "colors.h"
 #include "termpty.h"
-#if !defined(BINARY_TYFUZZ) && !defined(BINARY_TYTEST)
+#if !defined(BINARY_TYFUZZ) && !defined(BINARY_TYTEST) && !defined(BINARY_TYMUXD)
 #include "win.h"
 #endif
 #include "termiointernals.h"
diff --git a/src/bin/termiointernals.c b/src/bin/termiointernals.c
index 5acf80e4..04a38c65 100644
--- a/src/bin/termiointernals.c
+++ b/src/bin/termiointernals.c
@@ -1,6 +1,8 @@
 #include "private.h"
 
+#if !defined(BINARY_TYMUXD)
 #include <Elementary.h>
+#endif
 
 #include "termio.h"
 #include "miniview.h"
diff --git a/src/bin/termiointernals.h b/src/bin/termiointernals.h
index d4a3fc21..e3d0dbe9 100644
--- a/src/bin/termiointernals.h
+++ b/src/bin/termiointernals.h
@@ -1,7 +1,7 @@
 #ifndef TERMINOLOGY_TERMIOINTERNALS_H_
 #define TERMINOLOGY_TERMIOINTERNALS_H_ 1
 
-#if defined(BINARY_TYFUZZ) || defined(BINARY_TYTEST)
+#if defined(BINARY_TYFUZZ) || defined(BINARY_TYTEST) || defined(BINARY_TYMUXD)
 typedef void Term;
 #endif
 
diff --git a/src/bin/termiolink.c b/src/bin/termiolink.c
index 1a18a342..e834c9c6 100644
--- a/src/bin/termiolink.c
+++ b/src/bin/termiolink.c
@@ -1,7 +1,9 @@
 
 #if !defined(BINARY_TYFUZZ_COLOR_PARSER)
 #include "private.h"
+#if !defined(BINARY_TYMUXD)
 #include <Elementary.h>
+#endif
 #include <assert.h>
 #include <math.h>
 #include <limits.h>
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index d4ab1e38..588d2561 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -1,5 +1,7 @@
 #include "private.h"
+#if !defined(BINARY_TYMUXD)
 #include <Elementary.h>
+#endif
 #include <Ecore_Input.h>
 #include <Ecore_IMF.h>
 #include <Ecore_IMF_Evas.h>
@@ -8,11 +10,12 @@
 #include "termptyops.h"
 #include "backlog.h"
 #include "keyin.h"
-#if !defined(BINARY_TYFUZZ) && !defined(BINARY_TYTEST)
+#if !defined(BINARY_TYFUZZ) && !defined(BINARY_TYTEST) && !defined(BINARY_TYMUXD)
 # include "win.h"
 #endif
 #include "termio.h"
 #include <sys/types.h>
+#include <pwd.h>
 #include <signal.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
diff --git a/src/bin/termptydbl.c b/src/bin/termptydbl.c
index 071578c0..abce887a 100644
--- a/src/bin/termptydbl.c
+++ b/src/bin/termptydbl.c
@@ -1,7 +1,9 @@
 /* XXX: Code generated by tool unicode_dbl_width.py */
 #include "private.h"
 
+#if !defined(BINARY_TYMUXD)
 #include <Elementary.h>
+#endif
 #include "termpty.h"
 #include "termptydbl.h"
 
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 2eb26efb..8a9b3f92 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -1,5 +1,7 @@
 #include "private.h"
+#if !defined(BINARY_TYMUXD)
 #include <Elementary.h>
+#endif
 #include <stdint.h>
 #include <assert.h>
 #include "colors.h"
diff --git a/src/bin/termptyext.c b/src/bin/termptyext.c
index 88ef3148..34512f28 100644
--- a/src/bin/termptyext.c
+++ b/src/bin/termptyext.c
@@ -1,5 +1,7 @@
 #include "private.h"
+#if !defined(BINARY_TYMUXD)
 #include <Elementary.h>
+#endif
 #include "termio.h"
 #include "termiolink.h"
 #include "termpty.h"
diff --git a/src/bin/termptygfx.c b/src/bin/termptygfx.c
index 03d86a28..5c7e6159 100644
--- a/src/bin/termptygfx.c
+++ b/src/bin/termptygfx.c
@@ -1,5 +1,7 @@
 #include "private.h"
+#if !defined(BINARY_TYMUXD)
 #include <Elementary.h>
+#endif
 #include "termptygfx.h"
 
 /* translates VT100 ACS escape codes to Unicode values.
diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c
index 2e0fec93..c557d6f9 100644
--- a/src/bin/termptyops.c
+++ b/src/bin/termptyops.c
@@ -1,5 +1,7 @@
 #include "private.h"
+#if !defined(BINARY_TYMUXD)
 #include <Elementary.h>
+#endif
 #include "termio.h"
 #include "termpty.h"
 #include "termptydbl.h"
diff --git a/src/bin/termsession.c b/src/bin/termsession.c
new file mode 100644
index 00000000..5cd51c5c
--- /dev/null
+++ b/src/bin/termsession.c
@@ -0,0 +1,2 @@
+#include "private.h"
+#include "termsession.h"
diff --git a/src/bin/termsession.h b/src/bin/termsession.h
new file mode 100644
index 00000000..fb1c6e22
--- /dev/null
+++ b/src/bin/termsession.h
@@ -0,0 +1,3 @@
+#ifndef TERMINOLOGY_TERMSESSION_H_
+#define TERMINOLOGY_TERMSESSION_H_
+#endif
diff --git a/src/bin/tymux.c b/src/bin/tymux.c
new file mode 100644
index 00000000..30c488ad
--- /dev/null
+++ b/src/bin/tymux.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+int main(int argc, char **argv)
+{
+    (void)argc; (void)argv;
+    fprintf(stderr, "tymux: not yet implemented\n");
+    return 1;
+}
diff --git a/src/bin/tymux_session.c b/src/bin/tymux_session.c
new file mode 100644
index 00000000..a0c719ae
--- /dev/null
+++ b/src/bin/tymux_session.c
@@ -0,0 +1,2 @@
+#include "private.h"
+#include "tymux_session.h"
diff --git a/src/bin/tymux_session.h b/src/bin/tymux_session.h
new file mode 100644
index 00000000..c283c658
--- /dev/null
+++ b/src/bin/tymux_session.h
@@ -0,0 +1,3 @@
+#ifndef TERMINOLOGY_TYMUX_SESSION_H_
+#define TERMINOLOGY_TYMUX_SESSION_H_
+#endif
diff --git a/src/bin/tymuxd.c b/src/bin/tymuxd.c
new file mode 100644
index 00000000..6e718a85
--- /dev/null
+++ b/src/bin/tymuxd.c
@@ -0,0 +1,11 @@
+#include "private.h"
+#include "tymuxd.h"
+
+int _log_domain = -1;
+
+int main(int argc, char **argv)
+{
+   (void)argc;
+   (void)argv;
+   return 0;
+}
diff --git a/src/bin/tymuxd.h b/src/bin/tymuxd.h
new file mode 100644
index 00000000..5f449927
--- /dev/null
+++ b/src/bin/tymuxd.h
@@ -0,0 +1,3 @@
+#ifndef TERMINOLOGY_TYMUXD_H_
+#define TERMINOLOGY_TYMUXD_H_
+#endif
diff --git a/src/bin/tymuxd_stubs.c b/src/bin/tymuxd_stubs.c
new file mode 100644
index 00000000..ac028677
--- /dev/null
+++ b/src/bin/tymuxd_stubs.c
@@ -0,0 +1,234 @@
+/* Stub implementations of termio/miniview/config functions for tymuxd.
+ *
+ * tymuxd links against the same termpty* and termiointernals* translation
+ * units as the main terminology binary.  Those units call back into the
+ * display layer (termio, miniview, config) via the same public API.  Since
+ * tymuxd has no display layer these are empty no-op stubs that satisfy the
+ * linker without pulling in the full Elementary widget machinery.
+ */
+
+#include "private.h"
+#include <string.h>
+#include <Evas.h>
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Ecore_IMF.h>
+/* Elementary opaque types and enum stubs are defined in private.h under
+ * BINARY_TYMUXD.  No Elementary header is needed here. */
+#include "termio.h"
+#include "miniview.h"
+
+void
+main_config_sync(const Config *config EINA_UNUSED)
+{
+}
+
+Evas_Object *
+termio_get_cursor(const Evas_Object *obj EINA_UNUSED)
+{
+   return NULL;
+}
+
+Termio *
+termio_get_from_obj(Evas_Object *obj EINA_UNUSED)
+{
+   return NULL;
+}
+
+Config *
+termio_config_get(const Evas_Object *obj EINA_UNUSED)
+{
+   return NULL;
+}
+
+void
+termio_paste_selection(Evas_Object *obj EINA_UNUSED,
+                       Elm_Sel_Type type EINA_UNUSED)
+{
+}
+
+void
+termio_smart_update_queue(Termio *sd EINA_UNUSED)
+{
+}
+
+void
+termio_handle_right_click(Evas_Event_Mouse_Down *ev EINA_UNUSED,
+                          Termio *sd EINA_UNUSED,
+                          int cx EINA_UNUSED, int cy EINA_UNUSED)
+{
+}
+
+void
+termio_smart_cb_mouse_move_job(void *data EINA_UNUSED)
+{
+}
+
+void
+miniview_position_offset(const Evas_Object *obj EINA_UNUSED,
+                         int by EINA_UNUSED,
+                         Eina_Bool sanitize EINA_UNUSED)
+{
+}
+
+Evas_Object *
+term_miniview_get(const Term *term EINA_UNUSED)
+{
+   return NULL;
+}
+
+int
+termio_scroll_get(const Evas_Object *obj EINA_UNUSED)
+{
+   return 0;
+}
+
+void
+termio_size_get(const Evas_Object *obj EINA_UNUSED,
+                int *w, int *h)
+{
+   if (w) *w = 0;
+   if (h) *h = 0;
+}
+
+Termpty *
+termio_pty_get(const Evas_Object *obj EINA_UNUSED)
+{
+   return NULL;
+}
+
+Eina_Bool
+termio_cwd_get(const Evas_Object *obj EINA_UNUSED,
+               char *buf,
+               size_t size)
+{
+   if (buf && size > 0) buf[0] = '\0';
+   return EINA_TRUE;
+}
+
+void
+termio_sel_set(Termio *sd EINA_UNUSED, Eina_Bool enable EINA_UNUSED)
+{
+}
+
+void
+termio_object_geometry_get(Termio *sd EINA_UNUSED,
+                           Evas_Coord *x, Evas_Coord *y,
+                           Evas_Coord *w, Evas_Coord *h)
+{
+   if (x) *x = 0;
+   if (y) *y = 0;
+   if (w) *w = 0;
+   if (h) *h = 0;
+}
+
+void
+termio_font_size_set(Evas_Object *obj EINA_UNUSED,
+                     int size EINA_UNUSED)
+{
+}
+
+const char *
+term_preedit_str_get(Term *term EINA_UNUSED)
+{
+   return NULL;
+}
+
+void
+termio_block_activate(Evas_Object *obj EINA_UNUSED,
+                      Termblock *blk EINA_UNUSED)
+{
+}
+
+Eina_Bool
+termio_take_selection(Evas_Object *obj EINA_UNUSED,
+                      Elm_Sel_Type type EINA_UNUSED)
+{
+   return EINA_FALSE;
+}
+
+void
+termio_remove_links(Termio *sd)
+{
+   if (!sd) return;
+   sd->link.string = NULL;
+   sd->link.x1 = -1;
+   sd->link.y1 = -1;
+   sd->link.x2 = -1;
+   sd->link.y2 = -1;
+   sd->link.suspend = EINA_FALSE;
+   sd->link.id = 0;
+   sd->link.objs = 0;
+}
+
+void
+termio_set_cursor_shape(Evas_Object *obj EINA_UNUSED,
+                        Cursor_Shape shape EINA_UNUSED)
+{
+}
+
+void
+termio_reset_main_colors(Evas_Object *termio EINA_UNUSED)
+{
+}
+
+Evas_Object *
+termio_textgrid_get(const Evas_Object *obj EINA_UNUSED)
+{
+   return NULL;
+}
+
+Evas_Object *
+termio_bg_get(const Evas_Object *obj EINA_UNUSED)
+{
+   return NULL;
+}
+
+void
+termio_selection_buffer_get_cb(Evas_Object *obj EINA_UNUSED,
+                               Elm_Sel_Type type EINA_UNUSED,
+                               Elm_Sel_Format format EINA_UNUSED,
+                               Elm_Drop_Cb cb EINA_UNUSED,
+                               void *data EINA_UNUSED)
+{
+}
+
+void
+termio_set_selection_text(Evas_Object *obj EINA_UNUSED,
+                          Elm_Sel_Type type EINA_UNUSED,
+                          const char *text EINA_UNUSED)
+{
+}
+
+Eina_Bool
+termio_is_focused(const Evas_Object *obj EINA_UNUSED)
+{
+   return EINA_FALSE;
+}
+
+/* Elementary functions called from termptyesc.c / colors.c that have no
+ * meaningful implementation in the headless daemon. */
+
+const char *
+elm_app_data_dir_get(void)
+{
+   return "";
+}
+
+Eina_Bool
+elm_need_sys_notify(void)
+{
+   return EINA_FALSE;
+}
+
+void
+elm_sys_notify_send(unsigned int replaces_id EINA_UNUSED,
+                    const char *icon EINA_UNUSED,
+                    const char *summary EINA_UNUSED,
+                    const char *body EINA_UNUSED,
+                    int urgency EINA_UNUSED,
+                    int timeout EINA_UNUSED,
+                    void (*cb)(void *, unsigned int) EINA_UNUSED,
+                    void *data EINA_UNUSED)
+{
+}

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to