make keybindings easy to configure

This commit is contained in:
Daniel Micay 2012-05-31 09:31:54 -04:00
parent b52e7700ff
commit 9c7815314b
2 changed files with 20 additions and 8 deletions

View File

@ -1,5 +1,7 @@
#include <stdbool.h>
#include <gdk/gdkkeysyms.h>
#define URGENT_ON_BEEP
#define DYNAMIC_TITLE
#define CLICKABLE_URL
@ -47,3 +49,13 @@ static const bool visible_bell = false;
static const bool mouse_autohide = false;
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

View File

@ -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();
if (modifiers == (GDK_CONTROL_MASK|GDK_SHIFT_MASK)) {
switch (gdk_keyval_to_lower(event->keyval)) {
case GDK_KEY_c:
case KEY_COPY:
vte_terminal_copy_clipboard(VTE_TERMINAL(vte));
return TRUE;
case GDK_KEY_v:
case KEY_PASTE:
vte_terminal_paste_clipboard(VTE_TERMINAL(vte));
return TRUE;
case GDK_KEY_p:
case KEY_PREV:
vte_terminal_search_find_previous(VTE_TERMINAL(vte));
vte_terminal_copy_primary(VTE_TERMINAL(vte));
return TRUE;
case GDK_KEY_n:
case KEY_NEXT:
vte_terminal_search_find_next(VTE_TERMINAL(vte));
vte_terminal_copy_primary(VTE_TERMINAL(vte));
return TRUE;
case GDK_KEY_f:
case KEY_SEARCH:
open_search_dialog(vte, false, info);
return TRUE;
case GDK_KEY_b:
case KEY_RSEARCH:
open_search_dialog(vte, true, info);
return TRUE;
case GDK_KEY_j:
case KEY_URL:
search(VTE_TERMINAL(vte), url_regex, false);
return TRUE;
case GDK_KEY_k:
case KEY_RURL:
search(VTE_TERMINAL(vte), url_regex, true);
return TRUE;
}