This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch tymux
in repository terminology.
View the commit online.
commit 04b8423273da08c0f409a7d4fb5c601c7f61c63f
Author: [email protected] <[email protected]>
AuthorDate: Mon Mar 23 22:28:23 2026 -0600
feat: parse atn; escape to open new tymux tab
Add the \033}atn;<name>\0 escape sequence so a running tymux client can
request Terminology to open a new tab already attached to the named
tymux session, without forcing the user to create a shell tab first.
- termiointernals.h: add tymux_newtab_pending field (Eina_Stringshare)
- termio.c: include main.h; free tymux_newtab_pending on smart_del;
add _termio_tymux_newtab / _termio_tymux_newtab_job that call
main_new() then schedule a tymux switch on the new focused tab;
parse atn; escape in _smart_pty_command() inside HAVE_TYMUX guard
- win.h/win.c: add win_focused_term_get(Win*) under HAVE_TYMUX so
termio.c can retrieve the newly-focused term after main_new()
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
---
src/bin/termio.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++
src/bin/termiointernals.h | 3 +-
src/bin/win.c | 12 +++++++
src/bin/win.h | 1 +
4 files changed, 99 insertions(+), 1 deletion(-)
diff --git a/src/bin/termio.c b/src/bin/termio.c
index 24d69041..615f2053 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -24,6 +24,7 @@
#include "sb.h"
#include "utils.h"
#include "win.h"
+#include "main.h"
#if defined (__MacOSX__) || (defined (__MACH__) && defined (__APPLE__))
# include <sys/proc_info.h>
@@ -3567,6 +3568,7 @@ _smart_del(Evas_Object *obj)
#ifdef HAVE_TYMUX
eina_stringshare_del(sd->tymux_name);
eina_stringshare_del(sd->tymux_pending);
+ eina_stringshare_del(sd->tymux_newtab_pending);
#endif
eina_stringshare_del(sd->link.string);
if (sd->glayer) evas_object_del(sd->glayer);
@@ -3865,6 +3867,78 @@ _smart_tymux_resume(void *data)
sd->tymux->cb_change.func(sd->tymux->cb_change.data);
}
+/* Forward declaration — defined below after _termio_tymux_newtab_job. */
+static void _termio_tymux_switch_job(void *data);
+
+/* Deferred new-tab creation: opens a new tab, then schedules a tymux switch
+ * in that tab. Split into a separate job so that main_new() has time to
+ * complete and focus the new tab before we read the focused term back. */
+static void
+_termio_tymux_newtab_job(void *data)
+{
+ Evas_Object *obj = data;
+ Termio *sd = evas_object_smart_data_get(obj);
+ const char *tymux_name;
+ Win *wn;
+ Term *orig_term, *new_term;
+ Evas_Object *new_termio;
+ Termio *new_sd;
+
+ if (!sd) return;
+ tymux_name = sd->tymux_newtab_pending;
+ if (!tymux_name) return;
+ sd->tymux_newtab_pending = NULL;
+
+ if (!sd->term) { eina_stringshare_del(tymux_name); return; }
+
+ wn = term_win_get(sd->term);
+ if (!wn) { eina_stringshare_del(tymux_name); return; }
+
+ orig_term = sd->term;
+
+ /* Create a new shell tab and focus it. */
+ main_new(obj);
+
+ /* The newly created tab is now focused. */
+ new_term = win_focused_term_get(wn);
+ if (!new_term || new_term == orig_term)
+ {
+ ERR("tymux newtab: could not find new tab after main_new()");
+ eina_stringshare_del(tymux_name);
+ return;
+ }
+
+ new_termio = term_termio_get(new_term);
+ if (!new_termio)
+ {
+ eina_stringshare_del(tymux_name);
+ return;
+ }
+
+ new_sd = evas_object_smart_data_get(new_termio);
+ if (!new_sd)
+ {
+ eina_stringshare_del(tymux_name);
+ return;
+ }
+
+ /* Schedule a tymux switch in the new tab on the next iteration. */
+ eina_stringshare_replace(&new_sd->tymux_pending, tymux_name);
+ ecore_job_add(_termio_tymux_switch_job, new_termio);
+
+ eina_stringshare_del(tymux_name);
+}
+
+static void
+_termio_tymux_newtab(Evas_Object *obj, Termio *sd, const char *tymux_name)
+{
+ EINA_SAFETY_ON_NULL_RETURN(tymux_name);
+ if (!_tymux_name_valid(tymux_name)) return;
+
+ eina_stringshare_replace(&sd->tymux_newtab_pending, tymux_name);
+ ecore_job_add(_termio_tymux_newtab_job, obj);
+}
+
/* Deferred tymux switch — runs on the next Ecore main loop iteration
* so we don't free the PTY while we're still inside its read handler. */
static void
@@ -3985,6 +4059,16 @@ _smart_pty_command(void *data)
_termio_tymux_switch(obj, sd, sess);
return;
}
+ /* atn;<session_name> — open a NEW tab attached to the named tymux session.
+ * Emitted by the tymux client when the user requests a new window. */
+ if (ty->cur_cmd[0] == 'a' && ty->cur_cmd[1] == 't' &&
+ ty->cur_cmd[2] == 'n' && ty->cur_cmd[3] == ';')
+ {
+ const char *sess = &ty->cur_cmd[4];
+ if (sess[0] && _tymux_name_valid(sess))
+ _termio_tymux_newtab(obj, sd, sess);
+ return;
+ }
#endif
if (!config->ty_escapes)
diff --git a/src/bin/termiointernals.h b/src/bin/termiointernals.h
index 1b766b49..4c4292d0 100644
--- a/src/bin/termiointernals.h
+++ b/src/bin/termiointernals.h
@@ -81,7 +81,8 @@ struct tag_Termio
/* tymux_name: tymux name (eina_stringshare). Kept for display
* purposes (e.g. window title) even after the tymux fd is open. */
const char *tymux_name; /* eina_stringshare */
- const char *tymux_pending; /* eina_stringshare; deferred switch target */
+ const char *tymux_pending; /* eina_stringshare; deferred switch target */
+ const char *tymux_newtab_pending; /* eina_stringshare; deferred new-tab session */
#endif
Ecore_Animator *anim;
Ecore_Timer *delayed_size_timer;
diff --git a/src/bin/win.c b/src/bin/win.c
index 1eba848e..f5e333c8 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -1339,6 +1339,18 @@ _win_focused_term_get(const Term_Container *tc)
return term;
}
+#ifdef HAVE_TYMUX
+Term *
+win_focused_term_get(const Win *wn)
+{
+ const Term_Container *tc;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(wn, NULL);
+ tc = (const Term_Container *)wn;
+ return _win_focused_term_get(tc);
+}
+#endif
+
static Term *
_win_find_term_at_coords(const Term_Container *tc,
Evas_Coord mx, Evas_Coord my)
diff --git a/src/bin/win.h b/src/bin/win.h
index 3caed84b..b724431d 100644
--- a/src/bin/win.h
+++ b/src/bin/win.h
@@ -94,6 +94,7 @@ void main_trans_update(void);
#ifdef HAVE_TYMUX
void term_tymux_indicator_set(Term *term, Eina_Bool on);
void term_pause_set(Term *term, Eina_Bool paused);
+Term *win_focused_term_get(const Win *wn);
#endif
#endif
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.