make keybindings easy to configure
This commit is contained in:
parent
b52e7700ff
commit
9c7815314b
12
config.h
12
config.h
|
@ -1,5 +1,7 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include <gdk/gdkkeysyms.h>
|
||||||
|
|
||||||
#define URGENT_ON_BEEP
|
#define URGENT_ON_BEEP
|
||||||
#define DYNAMIC_TITLE
|
#define DYNAMIC_TITLE
|
||||||
#define CLICKABLE_URL
|
#define CLICKABLE_URL
|
||||||
|
@ -47,3 +49,13 @@ static const bool visible_bell = false;
|
||||||
static const bool mouse_autohide = false;
|
static const bool mouse_autohide = false;
|
||||||
|
|
||||||
static const char *term = "vte-256color";
|
static const char *term = "vte-256color";
|
||||||
|
|
||||||
|
// keybindings
|
||||||
|
#define KEY_COPY GDK_KEY_c
|
||||||
|
#define KEY_PASTE GDK_KEY_v
|
||||||
|
#define KEY_PREV GDK_KEY_p
|
||||||
|
#define KEY_NEXT GDK_KEY_n
|
||||||
|
#define KEY_SEARCH GDK_KEY_f
|
||||||
|
#define KEY_RSEARCH GDK_KEY_r
|
||||||
|
#define KEY_URL GDK_KEY_j
|
||||||
|
#define KEY_RURL GDK_KEY_k
|
||||||
|
|
16
termite.c
16
termite.c
|
@ -77,30 +77,30 @@ static gboolean key_press_cb(GtkWidget *vte, GdkEventKey *event, search_dialog_i
|
||||||
const GdkModifierType modifiers = event->state & gtk_accelerator_get_default_mod_mask();
|
const GdkModifierType modifiers = event->state & gtk_accelerator_get_default_mod_mask();
|
||||||
if (modifiers == (GDK_CONTROL_MASK|GDK_SHIFT_MASK)) {
|
if (modifiers == (GDK_CONTROL_MASK|GDK_SHIFT_MASK)) {
|
||||||
switch (gdk_keyval_to_lower(event->keyval)) {
|
switch (gdk_keyval_to_lower(event->keyval)) {
|
||||||
case GDK_KEY_c:
|
case KEY_COPY:
|
||||||
vte_terminal_copy_clipboard(VTE_TERMINAL(vte));
|
vte_terminal_copy_clipboard(VTE_TERMINAL(vte));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case GDK_KEY_v:
|
case KEY_PASTE:
|
||||||
vte_terminal_paste_clipboard(VTE_TERMINAL(vte));
|
vte_terminal_paste_clipboard(VTE_TERMINAL(vte));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case GDK_KEY_p:
|
case KEY_PREV:
|
||||||
vte_terminal_search_find_previous(VTE_TERMINAL(vte));
|
vte_terminal_search_find_previous(VTE_TERMINAL(vte));
|
||||||
vte_terminal_copy_primary(VTE_TERMINAL(vte));
|
vte_terminal_copy_primary(VTE_TERMINAL(vte));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case GDK_KEY_n:
|
case KEY_NEXT:
|
||||||
vte_terminal_search_find_next(VTE_TERMINAL(vte));
|
vte_terminal_search_find_next(VTE_TERMINAL(vte));
|
||||||
vte_terminal_copy_primary(VTE_TERMINAL(vte));
|
vte_terminal_copy_primary(VTE_TERMINAL(vte));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case GDK_KEY_f:
|
case KEY_SEARCH:
|
||||||
open_search_dialog(vte, false, info);
|
open_search_dialog(vte, false, info);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case GDK_KEY_b:
|
case KEY_RSEARCH:
|
||||||
open_search_dialog(vte, true, info);
|
open_search_dialog(vte, true, info);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case GDK_KEY_j:
|
case KEY_URL:
|
||||||
search(VTE_TERMINAL(vte), url_regex, false);
|
search(VTE_TERMINAL(vte), url_regex, false);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case GDK_KEY_k:
|
case KEY_RURL:
|
||||||
search(VTE_TERMINAL(vte), url_regex, true);
|
search(VTE_TERMINAL(vte), url_regex, true);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue