logo

badwolf

Minimalist and privacy-oriented WebKitGTK+ browser
commit: 8d79761a448e8b6391f4b348630017516aa07ab8
parent: 71b8af9d8c050ae6a78b76faf118751e2dd5607a
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat,  6 Jul 2019 13:50:28 +0200

Add toggling of caret browsing on F7

Diffstat:

Mbadwolf.12++
Mbadwolf.c12++++++++++++
2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/badwolf.1 b/badwolf.1 @@ -36,6 +36,8 @@ Focuses on the search entry Focuses on the location(URL) entry .It browser C-S-r / C-r, browser F5 Reloads the current tab (with/without clearing cache) +.It browser F7 +Toggles caret browsing. .It browser C-[ / C-] Go back/forward in current tab’s history .It any A-Left / A-Right diff --git a/badwolf.c b/badwolf.c @@ -165,6 +165,17 @@ WebViewCb_close(WebKitWebView *webView, gpointer user_data) return TRUE; } +static void +toggle_caret_browsing(WebKitWebView *webView) +{ + WebKitSettings *settings = webkit_web_view_get_settings(webView); + + webkit_settings_set_enable_caret_browsing(settings, + !webkit_settings_get_enable_caret_browsing(settings)); + + webkit_web_view_set_settings(webView, settings); +} + /* commonCb_key_press_event: Global callback for keybindings * * Theses shortcuts should be avoided as much as possible: @@ -236,6 +247,7 @@ commonCb_key_press_event(struct Window *window, GdkEvent *event, struct Client * switch(((GdkEventKey *)event)->keyval) { case GDK_KEY_F5: webkit_web_view_reload(browser->webView); return TRUE; + case GDK_KEY_F7: toggle_caret_browsing(browser->webView); return TRUE; } } else