From 62b1bd678521d87ae95d7f8bfbe13535ec2072e7 Mon Sep 17 00:00:00 2001 From: fenze Date: Fri, 16 Dec 2022 09:07:43 +0000 Subject: Add newtab binding --- build.sh | 1 + config.def.h | 8 +++++--- rose-mklink | 2 +- rose.c | 7 ++++++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index cffe9d5..fcb7bea 100755 --- a/build.sh +++ b/build.sh @@ -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 diff --git a/config.def.h b/config.def.h index fc5f0e4..8a10f74 100644 --- a/config.def.h +++ b/config.def.h @@ -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: { diff --git a/rose-mklink b/rose-mklink index a658930..2aaba72 100755 --- a/rose-mklink +++ b/rose-mklink @@ -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 } diff --git a/rose.c b/rose.c index 15baf7d..78bdd3b 100644 --- a/rose.c +++ b/rose.c @@ -7,7 +7,7 @@ * sublicense copies of this sotware for their own use. * This code does not come with any warranty. * - * Author: fenze + * @author: fenze */ #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; } -- cgit v1.2.3