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

git pushed a commit to branch desktop-restore
in repository terminology.

View the commit online.

commit 30c6faad6164260c417813db6b72cd7366471803
Author: [email protected] <[email protected]>
AuthorDate: Fri Mar 20 10:26:45 2026 -0600

    feat: add --all-sessions CLI flag to restore all saved sessions
    
    Add --all-sessions ecore_getopt option and all_sessions field to
    Ipc_Instance.  When passed (or when config session_restore_all is
    true), restore every saved session at startup.
    
    Window shows are batched via session_defer_show_begin/end to avoid
    focus events mid-loop.  If --session is also specified, it takes
    precedence with a warning.
---
 src/bin/ipc.h  |  1 +
 src/bin/main.c | 39 +++++++++++++++++++++++++++++++++++++++
 src/bin/win.c  |  8 +++++---
 3 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/src/bin/ipc.h b/src/bin/ipc.h
index 2a4f749b..9902ba71 100644
--- a/src/bin/ipc.h
+++ b/src/bin/ipc.h
@@ -20,6 +20,7 @@ struct tag_Ipc_Instance
    char *startup_id;
    char *startup_split;
    char *session;
+   Eina_Bool all_sessions;
    int x, y, w, h;
    Eina_Bool pos;
    Eina_Bool login_shell;
diff --git a/src/bin/main.c b/src/bin/main.c
index 83d29b28..0395f7b9 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -503,6 +503,8 @@ static Ecore_Getopt options = {
                               " More description available on the man page")),
       ECORE_GETOPT_STORE_STR ('\0', "session",
                               gettext_noop("Restore named session on startup")),
+      ECORE_GETOPT_STORE_TRUE('\0', "all-sessions",
+                              gettext_noop("Restore all saved sessions on startup")),
       ECORE_GETOPT_STORE_BOOL('l', "login",
                               gettext_noop("Run the shell as a login shell")),
       ECORE_GETOPT_STORE_BOOL('m', "video-mute",
@@ -609,6 +611,9 @@ _start(Ipc_Instance *instance, Eina_Bool need_scale_wizard)
 
    if (instance->session)
      {
+        if (instance->all_sessions || _main_config->session_restore_all)
+          WRN("--session and --all-sessions both specified; "
+              "--session takes precedence");
         if (!session_load(instance->session, NULL))
           {
              /* Session file missing or corrupt — open a default terminal instead */
@@ -620,6 +625,39 @@ _start(Ipc_Instance *instance, Eina_Bool need_scale_wizard)
         goto end;
      }
 
+   /* Restore all sessions if requested.  If --session was also set, its
+    * block above already ran and jumped to 'end', so we never reach here
+    * in that case. */
+   if (instance->all_sessions || _main_config->session_restore_all)
+     {
+        Eina_List *metas = session_meta_list();
+        if (metas)
+          {
+             Eina_List *l;
+             Session_Meta *m;
+             Eina_Bool loaded = EINA_FALSE;
+
+             /* Defer evas_object_show for all session windows until the
+              * entire restore loop completes.  This prevents focus events
+              * from firing mid-loop with partially-wired container trees. */
+             session_defer_show_begin();
+             EINA_LIST_FOREACH(metas, l, m)
+               {
+                  if (session_load(m->name, NULL))
+                    loaded = EINA_TRUE;
+               }
+             session_defer_show_end();
+             session_meta_list_free(metas);
+
+             if (loaded)
+               {
+                  terminology_starting_up = EINA_FALSE;
+                  goto end;
+               }
+          }
+        /* No sessions found or all failed — fall through to normal_start */
+     }
+
 normal_start:
    wn = win_new(instance->name, instance->role, instance->title,
                 instance->icon_name, instance->config,
@@ -868,6 +906,7 @@ elm_main(int argc, char **argv)
      ECORE_GETOPT_VALUE_STR(instance.font),             /* -f, --font */
      ECORE_GETOPT_VALUE_STR(instance.startup_split),    /* -S, --split */
      ECORE_GETOPT_VALUE_STR(instance.session),          /* --session */
+     ECORE_GETOPT_VALUE_BOOL(instance.all_sessions),    /* --all-sessions */
      ECORE_GETOPT_VALUE_BOOL(instance.login_shell),     /* -l, --login */
      ECORE_GETOPT_VALUE_BOOL(instance.video_mute),      /* -m, --video-mute */
      ECORE_GETOPT_VALUE_BOOL(instance.cursor_blink),    /* -c, --cursor-blink */
diff --git a/src/bin/win.c b/src/bin/win.c
index a042da17..cd03a70d 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -5620,6 +5620,9 @@ win_tabs_term_append(Term_Container *tabs_tc, Term *term)
    _tabs_attach(tabs_tc, solo_tc);
 }
 
+/* Set the active tab by index during session restore.  Uses the existing
+ * swallow mechanism to properly place content in the parent layout without
+ * triggering focus propagation (is_focused is FALSE during restore). */
 void
 win_tabs_focus_index(Term_Container *tabs_tc, int index)
 {
@@ -5642,9 +5645,8 @@ win_tabs_focus_index(Term_Container *tabs_tc, int index)
      {
         if (i == index)
           {
-             Term_Container *tc = tab_item->tc;
-             tc->focus(tc, tabs_tc);  /* propagates up vtable; does not write tabs->current */
-             tabs->current = tab_item;
+             if (tab_item != tabs->current)
+               tabs_tc->swallow(tabs_tc, tabs->current->tc, tab_item->tc);
              return;
           }
         i++;

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

Reply via email to