Add newtab binding

This commit is contained in:
fenze 2022-12-16 09:07:43 +00:00
parent 055e50c9ef
commit 62b1bd6785
4 changed files with 13 additions and 5 deletions

View File

@ -8,4 +8,5 @@ LIBS=`pkg-config --libs ${DEPS[@]}`
# Optional adblocking depends on https://github.com/jun7/wyebadblock
WYEBAB='-L/usr/lib/wyebrowser/adblock.so'
cp -f config.def.h config.h
$CC $INCS $LIBS $SRC $WYEBAB -o rose

View File

@ -27,7 +27,7 @@
#define KEY(x) GDK_KEY_##x
#define ZOOM 1 /* Starting zoom level */
#define ZOOM_VAL .1 /* Zooming value in zoomin/zoomout functions */
#define BG_COLOR "#1E1E2E" /* or e.g., "#FEFEFE" if not using dark theme */
#define BG_COLOR "#1E1E2E" /* or e.g., "#FEFEFE" if not using dark theme */
#define WIDTH 500
#define HEIGHT 400
@ -47,7 +47,8 @@ typedef enum {
show_searchbar,
show_finder,
finder_next,
finder_prev
finder_prev,
newtab
} func;
#define SFT 1 << 0
@ -74,7 +75,8 @@ static struct {
{ CTRL, KEY(e), show_searchbar },
{ CTRL, KEY(f), show_finder },
{ CTRL, KEY(n), finder_next },
{ CTRL | SFT, KEY(N), finder_prev }
{ CTRL | SFT, KEY(N), finder_prev },
{ CTRL, KEY(t), newtab }
};
/* For controls more akin to normal browsers, use:
{

View File

@ -7,7 +7,7 @@ test "$1" = "--help" || test -z "$1" && {
}
test -z "$2" || {
[ -f "/usr/bin/$1" ] && {
test -f "/usr/bin/$1" && {
echo "/usr/bin/$1 already exists, remove it first"
exit 1
}

7
rose.c
View File

@ -7,7 +7,7 @@
* sublicense copies of this sotware for their own use.
* This code does not come with any warranty.
*
* Author: fenze <contact@fenze.dev>
* @author: fenze <contact@fenze.dev>
*/
#include "config.h"
@ -233,8 +233,13 @@ int handle_key(func id, GtkNotebook *notebook)
webkit_find_controller_search_previous(
webkit_web_view_get_find_controller(notebook_get_webview(notebook)));
break;
case newtab:
notebook_append(notebook, NULL);
gtk_notebook_set_show_tabs(notebook, true);
}
return 1;
}