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 e57a44323ca0d8f238b2887eec65082e86fdf6e4
Author: Boris Faure <[email protected]>
AuthorDate: Tue Sep 15 22:12:27 2026 +0000

    config: make TERM a 3-way choice to be able to set it to TERMINOLOGY
---
 src/bin/config.c           | 45 ++++++++++++++++++++++++++++++++++--
 src/bin/config.h           | 15 +++++++++++-
 src/bin/main.c             |  2 +-
 src/bin/options_behavior.c | 57 ++++++++++++++++++++++++++++++++++++++++++++--
 src/bin/termpty.c          | 18 +++++++++------
 5 files changed, 124 insertions(+), 13 deletions(-)

diff --git a/src/bin/config.c b/src/bin/config.c
index f974bed7..d83ef30a 100644
--- a/src/bin/config.c
+++ b/src/bin/config.c
@@ -7,7 +7,7 @@
 #include "colors.h"
 #include "theme.h"
 
-#define CONF_VER 28
+#define CONF_VER 29
 #define CONFIG_KEY "config"
 
 #define LIM(v, min, max) {if (v >= max) v = max; else if (v <= min) v = min;}
@@ -22,6 +22,36 @@ _config_home_get(void)
    return efreet_config_home_get();
 }
 
+static const char *const _term_type_names[TERM_TYPE_LAST] =
+{
+   [TERM_TYPE_XTERM] = "xterm",
+   [TERM_TYPE_XTERM_256COLOR] = "xterm-256color",
+   [TERM_TYPE_TERMINOLOGY] = "terminology",
+};
+
+const char *
+config_term_type_name(int term_type)
+{
+   if ((term_type < 0) || (term_type >= TERM_TYPE_LAST))
+     term_type = TERM_TYPE_XTERM_256COLOR;
+   return _term_type_names[term_type];
+}
+
+int
+config_term_type_from_name(const char *name)
+{
+   int i;
+
+   if (!name)
+     return -1;
+   for (i = 0; i < TERM_TYPE_LAST; i++)
+     {
+        if (strcmp(_term_type_names[i], name) == 0)
+          return i;
+     }
+   return -1;
+}
+
 void
 config_init(void)
 {
@@ -153,6 +183,8 @@ config_init(void)
      (edd_base, Config, "multi_instance", multi_instance, EET_T_UCHAR);
    EET_DATA_DESCRIPTOR_ADD_BASIC
      (edd_base, Config, "xterm_256color", xterm_256color, EET_T_UCHAR);
+   EET_DATA_DESCRIPTOR_ADD_BASIC
+     (edd_base, Config, "term_type", term_type, EET_T_INT);
    EET_DATA_DESCRIPTOR_ADD_BASIC
      (edd_base, Config, "erase_is_del", erase_is_del, EET_T_UCHAR);
    EET_DATA_DESCRIPTOR_ADD_BASIC
@@ -307,6 +339,7 @@ config_sync(const Config *config_src, Config *config)
    config->urg_bell = config_src->urg_bell;
    config->multi_instance = config_src->multi_instance;
    config->xterm_256color = config_src->xterm_256color;
+   config->term_type = config_src->term_type;
    config->erase_is_del = config_src->erase_is_del;
    config->temporary = config_src->temporary;
    config->custom_geometry = config_src->custom_geometry;
@@ -587,6 +620,7 @@ config_new(void)
         config->urg_bell = EINA_TRUE;
         config->multi_instance = EINA_FALSE;
         config->xterm_256color = EINA_TRUE;
+        config->term_type = TERM_TYPE_XTERM_256COLOR;
         config->erase_is_del = EINA_FALSE;
         config->custom_geometry = EINA_FALSE;
         config->drag_links = EINA_FALSE;
@@ -825,7 +859,13 @@ config_load(void)
 #endif
                   EINA_FALLTHROUGH;
                   /*pass through*/
-                case CONF_VER: /* 28 */
+                case 28:
+                  /* the xterm_256color bool became a 3-way term_type */
+                  config->term_type = config->xterm_256color
+                     ? TERM_TYPE_XTERM_256COLOR : TERM_TYPE_XTERM;
+                  EINA_FALLTHROUGH;
+                  /*pass through*/
+                case CONF_VER: /* 29 */
                   config->version = CONF_VER;
                   break;
                 default:
@@ -914,6 +954,7 @@ config_fork(const Config *config)
    CPY(urg_bell);
    CPY(multi_instance);
    CPY(xterm_256color);
+   CPY(term_type);
    CPY(erase_is_del);
    CPY(custom_geometry);
    CPY(login_shell);
diff --git a/src/bin/config.h b/src/bin/config.h
index a3218d60..aaa75724 100644
--- a/src/bin/config.h
+++ b/src/bin/config.h
@@ -36,6 +36,15 @@ typedef enum tag_Cursor_Shape
    CURSOR_SHAPE_BAR = 2
 } Cursor_Shape;
 
+/* Value put in TERM for the child process. */
+typedef enum tag_Term_Type
+{
+   TERM_TYPE_XTERM = 0,
+   TERM_TYPE_XTERM_256COLOR = 1,
+   TERM_TYPE_TERMINOLOGY = 2,
+   TERM_TYPE_LAST
+} Term_Type;
+
 struct tag_Config
 {
    int               version;
@@ -87,7 +96,8 @@ struct tag_Config
    Eina_Bool         visualize;
    Eina_Bool         urg_bell;
    Eina_Bool         multi_instance;
-   Eina_Bool         xterm_256color;
+   Eina_Bool         xterm_256color; /* DEPRECATED, migrated to term_type */
+   int               term_type;
    Eina_Bool         erase_is_del;
    Eina_Bool         custom_geometry;
    Eina_Bool         drag_links;
@@ -111,6 +121,9 @@ struct tag_Config
    Eina_Bool         font_set; /* not in EET */
 };
 
+const char *config_term_type_name(int term_type);
+int config_term_type_from_name(const char *name);
+
 void config_init(void);
 void config_shutdown(void);
 void config_sync(const Config *config_src, Config *config);
diff --git a/src/bin/main.c b/src/bin/main.c
index 5384e26c..e2d0df67 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -128,7 +128,7 @@ _configure_instance(Ipc_Instance *inst)
 
    if (inst->xterm_256color)
      {
-        inst->config->xterm_256color = EINA_TRUE;
+        inst->config->term_type = TERM_TYPE_XTERM_256COLOR;
         inst->config->temporary = EINA_TRUE;
      }
    if (inst->video_mute != IPC_INSTANCE_OPT_UNSET)
diff --git a/src/bin/options_behavior.c b/src/bin/options_behavior.c
index 433e75f0..7bdb36bd 100644
--- a/src/bin/options_behavior.c
+++ b/src/bin/options_behavior.c
@@ -32,7 +32,6 @@ OPTIONS_CB(Behavior_Ctx, bell_rings, 0);
 OPTIONS_CB(Behavior_Ctx, flicker_on_key, 0);
 OPTIONS_CB(Behavior_Ctx, urg_bell, 0);
 OPTIONS_CB(Behavior_Ctx, multi_instance, 0);
-OPTIONS_CB(Behavior_Ctx, xterm_256color, 0);
 OPTIONS_CB(Behavior_Ctx, erase_is_del, 0);
 OPTIONS_CB(Behavior_Ctx, login_shell, 0);
 OPTIONS_CB(Behavior_Ctx, show_tabs,  0);
@@ -189,6 +188,60 @@ _parent_del_cb(void *data,
    free(ctx);
 }
 
+static void
+_term_type_changed_cb(void *data, Evas_Object *obj,
+                      void *event_info EINA_UNUSED)
+{
+   Behavior_Ctx *ctx = data;
+   Config *config = ctx->config;
+
+   config->term_type = elm_radio_value_get(obj);
+
+   termio_config_update(ctx->term);
+   windows_update();
+   config_save(config);
+}
+
+static void
+_add_term_type_option(Evas_Object *bx,
+                      Behavior_Ctx *ctx)
+{
+   Evas_Object *lbl, *rd, *rdg = NULL;
+   int i;
+   static const char *const labels[TERM_TYPE_LAST] =
+   {
+      [TERM_TYPE_XTERM] = "xterm",
+      [TERM_TYPE_XTERM_256COLOR] = "xterm-256color",
+      [TERM_TYPE_TERMINOLOGY] = "terminology",
+   };
+
+   lbl = elm_label_add(bx);
+   evas_object_size_hint_weight_set(lbl, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(lbl, 0.0, 0.0);
+   elm_layout_text_set(lbl, NULL, _("Set TERM to:"));
+   elm_box_pack_end(bx, lbl);
+   evas_object_show(lbl);
+
+   for (i = 0; i < TERM_TYPE_LAST; i++)
+     {
+        rd = elm_radio_add(bx);
+        evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0);
+        evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, 0.5);
+        elm_object_text_set(rd, labels[i]);
+        elm_radio_state_value_set(rd, i);
+        if (!rdg)
+          rdg = rd;
+        else
+          elm_radio_group_add(rd, rdg);
+        elm_box_pack_end(bx, rd);
+        evas_object_show(rd);
+        evas_object_smart_callback_add(rd, "changed",
+                                       _term_type_changed_cb, ctx);
+     }
+
+   elm_radio_value_set(rdg, ctx->config->term_type);
+}
+
 static void
 _cursors_changed_cb(void *data, Evas_Object *obj,
                     void *event_info EINA_UNUSED)
@@ -409,7 +462,7 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
    OPTIONS_CX(_("Urgent Bell"), urg_bell, 0);
    OPTIONS_SEPARATOR;
    OPTIONS_CX(_("Multiple instances, one process"), multi_instance, 0);
-   OPTIONS_CX(_("Set TERM to xterm-256color"), xterm_256color, 0);
+   _add_term_type_option(bx, ctx);
    OPTIONS_CX(_("BackArrow sends Del (instead of BackSpace)"), erase_is_del, 0);
    OPTIONS_CX(_("Start as login shell"), login_shell, 0);
    OPTIONS_CX(_("Open new terminals in current working directory"), changedir_to_current, 0);
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index a74ee2d4..40527a36 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -743,14 +743,18 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
         unsetenv("COLUMNS");
         unsetenv("LINES");
 
-        /* pretend to be xterm */
-        if (config->xterm_256color)
+        switch (config->term_type)
           {
-             putenv("TERM=xterm-256color");
-          }
-        else
-          {
-             putenv("TERM=xterm");
+           case TERM_TYPE_XTERM:
+              putenv("TERM=xterm");
+              break;
+           case TERM_TYPE_TERMINOLOGY:
+              putenv("TERM=terminology");
+              break;
+           case TERM_TYPE_XTERM_256COLOR:
+           default:
+              putenv("TERM=xterm-256color");
+              break;
           }
         putenv("XTERM_256_COLORS=1");
         putenv("TERM_PROGRAM=terminology");

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

Reply via email to