aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Williams <andy@andywilliams.me>2016-03-06 13:22:49 +0100
committerBoris Faure <billiob@gmail.com>2016-03-06 13:22:54 +0100
commitd293b2531affed91f344d4e36f5e096644c1116b (patch)
treec8cded03cf7cd4f6eee221e76d8ef2e64fff9fad
parentwin: be sure we have a child to unfocus. Closes T3260 (diff)
downloadterminology-d293b2531affed91f344d4e36f5e096644c1116b.tar.gz
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
-rw-r--r--src/bin/config.c17
-rw-r--r--src/bin/keyin.c22
2 files changed, 37 insertions, 2 deletions
diff --git a/src/bin/config.c b/src/bin/config.c
index 4486f58..54ed8ac 100644
--- a/src/bin/config.c
+++ b/src/bin/config.c
@@ -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)
diff --git a/src/bin/keyin.c b/src/bin/keyin.c
index 1aed059..14731b2 100644
--- a/src/bin/keyin.c
+++ b/src/bin/keyin.c
@@ -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},