From 2425cad5171932d32b96752fc15c608ab3944227 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 21 Jun 2019 00:00:05 +0200 Subject: Add Alt-n tab switching --- badwolf.1 | 2 ++ badwolf.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/badwolf.1 b/badwolf.1 index 01af4e8..864b598 100644 --- a/badwolf.1 +++ b/badwolf.1 @@ -42,6 +42,8 @@ Go back/forward in current tab’s history Go to the previous/next tab .It any F1 Shows the about dialog +.It any Alt-n +Where n is any numeric-row key. Go to the n-th tab, 0 goes to the last one. .El .Ss DEFAULT ONES Here is a incomplete list of the default Webkit/GTK keybindings: diff --git a/badwolf.c b/badwolf.c index f512ba3..70306da 100644 --- a/badwolf.c +++ b/badwolf.c @@ -213,13 +213,16 @@ commonCb_key_press_event(struct Window *window, GdkEvent *event, struct Client * } } - if((((GdkEventKey *)event)->state & GDK_MOD1_MASK) && browser != NULL) + if((((GdkEventKey *)event)->state & GDK_MOD1_MASK)) { switch(((GdkEventKey *)event)->keyval) { case GDK_KEY_Left: gtk_notebook_prev_page(notebook); return TRUE; case GDK_KEY_Right: gtk_notebook_next_page(notebook); return TRUE; } + if((((GdkEventKey *)event)->keyval >= GDK_KEY_0) && + (((GdkEventKey *)event)->keyval <= GDK_KEY_9)) + gtk_notebook_set_current_page(notebook, (((GdkEventKey *)event)->keyval - GDK_KEY_1)); } if(browser != NULL) -- cgit v1.3.1-23-gd82d