forked from enlightenment/terminology
have a config to choose whether to set TERM to xterm-256color
This commit is contained in:
parent
02e42a747b
commit
ef543aa753
|
@ -83,6 +83,8 @@ config_init(void)
|
||||||
(edd_base, Config, "urg_bell", urg_bell, EET_T_UCHAR);
|
(edd_base, Config, "urg_bell", urg_bell, EET_T_UCHAR);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC
|
EET_DATA_DESCRIPTOR_ADD_BASIC
|
||||||
(edd_base, Config, "multi_instance", multi_instance, EET_T_UCHAR);
|
(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
|
EET_DATA_DESCRIPTOR_ADD_BASIC
|
||||||
(edd_base, Config, "custom_geometry", custom_geometry, EET_T_UCHAR);
|
(edd_base, Config, "custom_geometry", custom_geometry, EET_T_UCHAR);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC
|
EET_DATA_DESCRIPTOR_ADD_BASIC
|
||||||
|
@ -176,6 +178,7 @@ config_sync(const Config *config_src, Config *config)
|
||||||
config->multi_instance = config_src->multi_instance;
|
config->multi_instance = config_src->multi_instance;
|
||||||
config->application_server = config_src->application_server;
|
config->application_server = config_src->application_server;
|
||||||
config->application_server_restore_views = config_src->application_server_restore_views;
|
config->application_server_restore_views = config_src->application_server_restore_views;
|
||||||
|
config->xterm_256color = config_src->xterm_256color;
|
||||||
config->temporary = config_src->temporary;
|
config->temporary = config_src->temporary;
|
||||||
config->custom_geometry = config_src->custom_geometry;
|
config->custom_geometry = config_src->custom_geometry;
|
||||||
config->cg_width = config_src->cg_width;
|
config->cg_width = config_src->cg_width;
|
||||||
|
@ -434,6 +437,7 @@ config_load(const char *key)
|
||||||
config->multi_instance = EINA_FALSE;
|
config->multi_instance = EINA_FALSE;
|
||||||
config->application_server = EINA_FALSE;
|
config->application_server = EINA_FALSE;
|
||||||
config->application_server_restore_views = EINA_FALSE;
|
config->application_server_restore_views = EINA_FALSE;
|
||||||
|
config->xterm_256color = EINA_FALSE;
|
||||||
config->custom_geometry = EINA_FALSE;
|
config->custom_geometry = EINA_FALSE;
|
||||||
config->cg_width = 80;
|
config->cg_width = 80;
|
||||||
config->cg_height = 24;
|
config->cg_height = 24;
|
||||||
|
@ -484,6 +488,7 @@ config_fork(Config *config)
|
||||||
CPY(multi_instance);
|
CPY(multi_instance);
|
||||||
CPY(application_server);
|
CPY(application_server);
|
||||||
CPY(application_server_restore_views);
|
CPY(application_server_restore_views);
|
||||||
|
CPY(xterm_256color);
|
||||||
CPY(custom_geometry);
|
CPY(custom_geometry);
|
||||||
CPY(cg_width);
|
CPY(cg_width);
|
||||||
CPY(cg_height);
|
CPY(cg_height);
|
||||||
|
|
|
@ -42,6 +42,7 @@ struct _Config
|
||||||
Eina_Bool multi_instance;
|
Eina_Bool multi_instance;
|
||||||
Eina_Bool application_server;
|
Eina_Bool application_server;
|
||||||
Eina_Bool application_server_restore_views;
|
Eina_Bool application_server_restore_views;
|
||||||
|
Eina_Bool xterm_256color;
|
||||||
Eina_Bool custom_geometry;
|
Eina_Bool custom_geometry;
|
||||||
Eina_Bool drag_links;
|
Eina_Bool drag_links;
|
||||||
int cg_width;
|
int cg_width;
|
||||||
|
|
|
@ -143,6 +143,16 @@ _cb_op_behavior_application_server_chg(void *data, Evas_Object *obj, void *event
|
||||||
config_save(config, NULL);
|
config_save(config, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_op_behavior_xterm_256color_chg(void *data, Evas_Object *obj,
|
||||||
|
void *event EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Evas_Object *term = data;
|
||||||
|
Config *config = termio_config_get(term);
|
||||||
|
config->xterm_256color = elm_check_state_get(obj);
|
||||||
|
config_save(config, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_op_behavior_wsep_chg(void *data, Evas_Object *obj, void *event EINA_UNUSED)
|
_cb_op_behavior_wsep_chg(void *data, Evas_Object *obj, void *event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
@ -346,6 +356,16 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
|
||||||
evas_object_smart_callback_add(o, "changed",
|
evas_object_smart_callback_add(o, "changed",
|
||||||
_cb_op_behavior_multi_instance_chg, term);
|
_cb_op_behavior_multi_instance_chg, term);
|
||||||
|
|
||||||
|
o = elm_check_add(bx);
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
|
||||||
|
elm_object_text_set(o, "set TERM to xterm-256color");
|
||||||
|
elm_check_state_set(o, config->xterm_256color);
|
||||||
|
elm_box_pack_end(bx, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
evas_object_smart_callback_add(o, "changed",
|
||||||
|
_cb_op_behavior_xterm_256color_chg, term);
|
||||||
|
|
||||||
o = elm_check_add(bx);
|
o = elm_check_add(bx);
|
||||||
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
|
||||||
|
|
|
@ -4172,7 +4172,8 @@ termio_add(Evas_Object *parent, Config *config, const char *cmd, Eina_Bool login
|
||||||
_smart_cb_drop, obj);
|
_smart_cb_drop, obj);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sd->pty = termpty_new(cmd, login_shell, cd, w, h, config->scrollback);
|
sd->pty = termpty_new(cmd, login_shell, cd, w, h, config->scrollback,
|
||||||
|
config->xterm_256color);
|
||||||
if (!sd->pty)
|
if (!sd->pty)
|
||||||
{
|
{
|
||||||
ERR("Cannot allocate termpty");
|
ERR("Cannot allocate termpty");
|
||||||
|
|
|
@ -31,5 +31,6 @@ const char *termio_title_get(Evas_Object *obj);
|
||||||
const char *termio_icon_name_get(Evas_Object *obj);
|
const char *termio_icon_name_get(Evas_Object *obj);
|
||||||
void termio_debugwhite_set(Evas_Object *obj, Eina_Bool dbg);
|
void termio_debugwhite_set(Evas_Object *obj, Eina_Bool dbg);
|
||||||
void termio_config_set(Evas_Object *obj, Config *config);
|
void termio_config_set(Evas_Object *obj, Config *config);
|
||||||
|
Config *termio_config_get(const Evas_Object *obj);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -267,7 +267,8 @@ _limit_coord(Termpty *ty, Termstate *state)
|
||||||
}
|
}
|
||||||
|
|
||||||
Termpty *
|
Termpty *
|
||||||
termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd, int w, int h, int backscroll)
|
termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
|
||||||
|
int w, int h, int backscroll, Eina_Bool xterm_256color)
|
||||||
{
|
{
|
||||||
Termpty *ty;
|
Termpty *ty;
|
||||||
const char *pty;
|
const char *pty;
|
||||||
|
@ -399,9 +400,15 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd, int w, int h
|
||||||
|
|
||||||
/* TODO: should we reset signals here? */
|
/* TODO: should we reset signals here? */
|
||||||
|
|
||||||
// pretend to be xterm
|
/* pretend to be xterm */
|
||||||
putenv("TERM=xterm");
|
if (xterm_256color)
|
||||||
// putenv("TERM=xterm-256color");
|
{
|
||||||
|
putenv("TERM=xterm-256color");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
putenv("TERM=xterm");
|
||||||
|
}
|
||||||
putenv("XTERM_256_COLORS=1");
|
putenv("XTERM_256_COLORS=1");
|
||||||
if (!login_shell)
|
if (!login_shell)
|
||||||
execvp(args[0], (char *const *)args);
|
execvp(args[0], (char *const *)args);
|
||||||
|
|
|
@ -191,7 +191,8 @@ struct _Termexp
|
||||||
void termpty_init(void);
|
void termpty_init(void);
|
||||||
void termpty_shutdown(void);
|
void termpty_shutdown(void);
|
||||||
|
|
||||||
Termpty *termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd, int w, int h, int backscroll);
|
Termpty *termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
|
||||||
|
int w, int h, int backscroll, Eina_Bool xterm_256color);
|
||||||
void termpty_free(Termpty *ty);
|
void termpty_free(Termpty *ty);
|
||||||
void termpty_cellcomp_freeze(Termpty *ty);
|
void termpty_cellcomp_freeze(Termpty *ty);
|
||||||
void termpty_cellcomp_thaw(Termpty *ty);
|
void termpty_cellcomp_thaw(Termpty *ty);
|
||||||
|
|
Loading…
Reference in New Issue