forked from enlightenment/terminology
shortcuts: Open new terminals with ctrl+shift+n
Summary: Add a new configurable key binding to open a new terminal window Test Plan: Either wipe your terminology configuration or bind the new "Open a new terminal window" option to ctrl+shift+n. Tapping that key combination will then open a new window. Reviewers: billiob Differential Revision: https://phab.enlightenment.org/D3746
This commit is contained in:
parent
22a3237960
commit
d293b2531a
|
@ -7,7 +7,7 @@
|
|||
#include "col.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define CONF_VER 7
|
||||
#define CONF_VER 8
|
||||
|
||||
#define LIM(v, min, max) {if (v >= max) v = max; else if (v <= min) v = min;}
|
||||
|
||||
|
@ -340,6 +340,7 @@ _add_default_keys(Config *config)
|
|||
ADD_KB("v", 1, 0, 1, 0, "paste_clipboard");
|
||||
ADD_KB("h", 1, 0, 1, 0, "miniview");
|
||||
ADD_KB("Insert", 1, 0, 1, 0, "paste_clipboard");
|
||||
ADD_KB("n", 1, 0, 1, 0, "term_new");
|
||||
|
||||
/* Ctrl-Alt- */
|
||||
ADD_KB("equal", 1, 1, 0, 0, "increase_font_size");
|
||||
|
@ -359,6 +360,15 @@ _add_default_keys(Config *config)
|
|||
ADD_KB("KP_Divide", 0, 0, 1, 0, "copy_clipboard");
|
||||
}
|
||||
|
||||
static void
|
||||
_add_key(Config *config, const char *name, int ctrl, int alt, int shift,
|
||||
int win, const char *cb_name)
|
||||
{
|
||||
Config_Keys *kb;
|
||||
|
||||
ADD_KB(name, ctrl, alt, shift, win, cb_name);
|
||||
}
|
||||
|
||||
#undef ADD_KB
|
||||
|
||||
|
||||
|
@ -556,8 +566,11 @@ config_load(const char *key)
|
|||
case 6:
|
||||
config->changedir_to_current = EINA_TRUE;
|
||||
/*pass through*/
|
||||
case CONF_VER: /* 7 */
|
||||
case 7:
|
||||
config->version = CONF_VER;
|
||||
/*pass through*/
|
||||
case CONF_VER: /* 8 */
|
||||
_add_key(config, "n", 1, 0, 1, 0, "term_new");
|
||||
break;
|
||||
default:
|
||||
if (config->version < CONF_VER)
|
||||
|
|
|
@ -366,6 +366,27 @@ cb_term_next(Evas_Object *termio_obj)
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
cb_term_new(Evas_Object *termio_obj)
|
||||
{
|
||||
char path[PATH_MAX], cwd[PATH_MAX], *cmd;
|
||||
const char *template = "%s -d %s";
|
||||
int length;
|
||||
|
||||
eina_file_path_join(path, sizeof(path), elm_app_bin_dir_get(),
|
||||
"terminology");
|
||||
termio_cwd_get(termio_obj, cwd, sizeof(cwd));
|
||||
|
||||
length = (strlen(path) + strlen(cwd) + strlen(template) - 3);
|
||||
cmd = malloc(sizeof(char) * length);
|
||||
snprintf(cmd, length, template, path, cwd);
|
||||
|
||||
ecore_exe_run(cmd, NULL);
|
||||
free(cmd);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
#define CB_TAB(N) \
|
||||
static Eina_Bool \
|
||||
cb_tab_##N(Evas_Object *termio_obj) \
|
||||
|
@ -604,6 +625,7 @@ static Shortcut_Action _actions[] =
|
|||
{"reset_font_size", gettext_noop("Reset font size"), cb_reset_font_size},
|
||||
|
||||
{"group", gettext_noop("Actions"), NULL},
|
||||
{"term_new", gettext_noop("Open a new terminal window"), cb_term_new},
|
||||
{"win_fullscreen", gettext_noop("Toggle Fullscreen of the window"), cb_win_fullscreen},
|
||||
{"miniview", gettext_noop("Display the history miniview"), cb_miniview},
|
||||
{"cmd_box", gettext_noop("Display the command box"), cb_cmd_box},
|
||||
|
|
Loading…
Reference in New Issue