From 38dae3a9d35e2d4cbf87952b46cfc20ea31b7a4d Mon Sep 17 00:00:00 2001 From: fenze Date: Sat, 14 May 2022 12:04:26 +0200 Subject: [PATCH] add gotop and gobottom functions --- config.h | 4 +++- keyconf.h | 4 +++- scripts/dmenu_rose.sh | 2 ++ window.c | 10 ++++++++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/config.h b/config.h index 0934854..5df0e03 100644 --- a/config.h +++ b/config.h @@ -29,5 +29,7 @@ KEYBINDS { { MODKEY, GDK_KEY_r, reload }, { MODSFT, GDK_KEY_R, reloadforce }, { NOMODK, GDK_KEY_F11, fullscreen }, - { MODSFT, GDK_KEY_H, history } + { MODSFT, GDK_KEY_H, history }, + { MODKEY, GDK_KEY_g, gotop }, + { MODSFT, GDK_KEY_G, gobottom } }; diff --git a/keyconf.h b/keyconf.h index 36adfba..c1e1880 100644 --- a/keyconf.h +++ b/keyconf.h @@ -46,5 +46,7 @@ enum { up, reload, reloadforce, - history + history, + gotop, + gobottom }; diff --git a/scripts/dmenu_rose.sh b/scripts/dmenu_rose.sh index 8cd60e0..224c91f 100755 --- a/scripts/dmenu_rose.sh +++ b/scripts/dmenu_rose.sh @@ -1,5 +1,7 @@ #!/bin/sh +# FIXME: Sometimes when new bookmark added cant open it + BOOKMARKS_PATH=~/.cache/rose/bookmarks search() diff --git a/window.c b/window.c index 184a688..fe920b4 100644 --- a/window.c +++ b/window.c @@ -181,6 +181,16 @@ static gboolean key_press_callback(RoseWindow *window, } } break; + case gotop: { + webkit_web_view_run_javascript(window->webview, "window.scrollTo(0,0);", NULL, NULL, NULL); + } break; + + case gobottom: { + webkit_web_view_run_javascript( + window->webview, + "window.scrollTo(0, document.body.scrollHeight);", + NULL, NULL, NULL); + } break; } } }