commit: 8417d6af927813e32db7fb6bfc15213e3800303c
parent: 5d38e8a749587963332f5918d9063a697ac45d6f
author: Chris Noxz <chris@noxz.tech>
date: Tue, 2 May 2023 12:44:22 +0200
set zoom level using keyboard
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/browser.c b/browser.c
@@ -447,6 +447,17 @@ key_common(struct Client *c,
case GDK_KEY_9: /* go to nth tab */
gtk_notebook_set_current_page(GTK_NOTEBOOK(mw.nb), event->keyval-0x31);
return TRUE;
+ case GDK_KEY_0:
+ case GDK_KEY_minus:
+ case GDK_KEY_equal: /* set zoom level */
+ webkit_web_view_set_zoom_level(
+ WEBKIT_WEB_VIEW(c->wv),
+ event->keyval == GDK_KEY_0
+ ? CFG_F(ZoomLevel)
+ : webkit_web_view_get_zoom_level(WEBKIT_WEB_VIEW(c->wv))
+ + ((event->keyval == GDK_KEY_minus) ? -0.1 : 0.1)
+ );
+ return TRUE;
case GDK_KEY_H: /* go back in history */
webkit_web_view_go_back(WEBKIT_WEB_VIEW(c->wv));
return TRUE;
@@ -606,7 +617,8 @@ key_web_view(struct Client *c,
WEBKIT_WEB_VIEW(c->wv),
dx != 0
? CFG_F(ZoomLevel)
- : webkit_web_view_get_zoom_level(WEBKIT_WEB_VIEW(c->wv)) + -dy*0.1);
+ : webkit_web_view_get_zoom_level(WEBKIT_WEB_VIEW(c->wv)) + -dy * 0.1
+ );
return TRUE;
}