add gotop and gobottom functions

This commit is contained in:
fenze 2022-05-14 12:04:26 +02:00
parent 88efc15704
commit 38dae3a9d3
4 changed files with 18 additions and 2 deletions

View File

@ -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 }
};

View File

@ -46,5 +46,7 @@ enum {
up,
reload,
reloadforce,
history
history,
gotop,
gobottom
};

View File

@ -1,5 +1,7 @@
#!/bin/sh
# FIXME: Sometimes when new bookmark added cant open it
BOOKMARKS_PATH=~/.cache/rose/bookmarks
search()

View File

@ -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;
}
}
}