logo

badwolf

Minimalist and privacy-oriented WebKitGTK+ browser
commit: 800e9ca61f003983ca69046ebe0d67d83572ef57
parent: 6944c8422e9b4508f88b747752ebb35d3cbea120
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri,  5 Apr 2019 01:05:04 +0200

Merge branch 'develop'

Diffstat:

Abadwolf.136++++++++++++++++++++++++++++++++++++
Mbadwolf.c60+++++++++++++++++++++++++++++++++++++++---------------------
Mconfig.h3+++
3 files changed, 78 insertions(+), 21 deletions(-)

diff --git a/badwolf.1 b/badwolf.1 @@ -0,0 +1,36 @@ +./" BadWolf: Minimalist and privacy-oriented WebKitGTK+ browser +./" Copyright © 2019 Haelwenn (lanodan) Monnier <contact@hacktivis.me> +./" SPDX-License-Identifier: BSD-3-Clause +.Dd 2019-04-02 +.Dt badwolf 1 +.Sh NAME +.Nm badwolf +.Nd minimalist and privacy-oriented WebkitGTK browser +.Sh SYNOPSIS +.Nm +.Op Ar webkit/gtk options +.Op Ar url +.Sh DESCRIPTION +.Nm +is a minimalist browser that care about privacy, it is based on WebKitGTK and thus also accepts WebKitGTK (and depdendencies) flags and environment variables, unfortunately there doesn't seems to be manpages for theses. +.Pp +Runtime configuration specific to +.Nm +will probably get added at a later release. +.Sh KEYBINDINGS +For now it only has the default Webkit/GTK keybindings, which notably are (C for Control, S for Shift): +.Bl -width Ds -tag +.It any C-PageUp, any C-PageDown, tabs arrows +When WebView isn't focused (bug to fix) this allows to move from one tab to another. +.It search C-g, search C-S-g +When the search box is focused it goes to the Next/Previous search term. +.El +.Sh BUGS +You can submit contributions or tickets to +.Lk https://gitlab.com/lanodan/badwolf +or +.Mt contact+badwolf@hacktivis.me , +with +.Xr git-send-email 1 for patches. +.Sh AUTHORS +.An Haelwenn (lanodan) Monnier Aq Mt contact+badwolf@hacktivis.me diff --git a/badwolf.c b/badwolf.c @@ -22,14 +22,16 @@ struct Client GtkWidget *toolbar; GtkWidget *javascript; GtkWidget *location; - GtkWidget *search; - GtkWidget *statusbar; WebKitWebView *webView; struct Window *window; + + GtkWidget *statusbar; + GtkWidget *statuslabel; + GtkWidget *search; }; -static gboolean WebViewCb_close(WebKitWebView *webView, GtkWidget *window); +static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data); static gboolean WebViewCb_web_process_terminated(WebKitWebView *webView, WebKitWebProcessTerminationReason reason); static gboolean @@ -63,10 +65,22 @@ int badwolf_new_tab(GtkNotebook *notebook, struct Client *browser); GtkWidget *badwolf_new_tab_box(const gchar *title, struct Client *browser); int main(int argc, char *argv[]); -static gboolean WebViewCb_close(WebKitWebView *webView, GtkWidget *window) +static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data) { (void)webView; - gtk_widget_destroy(window); + struct Client *browser = (struct Client *)user_data; + GtkNotebook *notebook = GTK_NOTEBOOK(browser->window->notebook); + GValue position = G_VALUE_INIT; + g_value_init(&position, G_TYPE_INT); + + gtk_container_child_get_property(GTK_CONTAINER(notebook), browser->box, "position", &position); + + gtk_notebook_remove_page(notebook, g_value_get_int(&position)); + + gtk_widget_destroy(browser->box); + + free(browser); + return TRUE; } @@ -201,7 +215,7 @@ static gboolean WebViewCb_mouse_target_changed(WebKitWebView *webView, struct Client *browser = (struct Client *)user_data; const gchar *link_uri = webkit_hit_test_result_get_link_uri(hit); - gtk_label_set_text(GTK_LABEL(browser->statusbar), link_uri); + gtk_label_set_text(GTK_LABEL(browser->statuslabel), link_uri); return TRUE; } @@ -304,9 +318,11 @@ new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web browser->box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); browser->toolbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); browser->location = gtk_entry_new(); - browser->search = gtk_search_entry_new(); browser->javascript = gtk_check_button_new(); - browser->statusbar = gtk_label_new(NULL); + + browser->statusbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); + browser->statuslabel = gtk_label_new(NULL); + browser->search = gtk_search_entry_new(); WebKitWebContext *web_context = webkit_web_context_new_ephemeral(); webkit_web_context_set_process_model(web_context, @@ -335,21 +351,29 @@ new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web TRUE, TRUE, BADWOLF_TOOLBAR_PADDING); - gtk_box_pack_start(GTK_BOX(browser->toolbar), - GTK_WIDGET(browser->search), - FALSE, - FALSE, - BADWOLF_TOOLBAR_PADDING); gtk_box_pack_start( GTK_BOX(browser->box), GTK_WIDGET(browser->toolbar), FALSE, FALSE, BADWOLF_BOX_PADDING); gtk_box_pack_start( GTK_BOX(browser->box), GTK_WIDGET(browser->webView), TRUE, TRUE, BADWOLF_BOX_PADDING); + gtk_box_pack_start( GTK_BOX(browser->box), GTK_WIDGET(browser->statusbar), FALSE, FALSE, BADWOLF_BOX_PADDING); + gtk_box_pack_start(GTK_BOX(browser->statusbar), + GTK_WIDGET(browser->search), + FALSE, + FALSE, + BADWOLF_STATUSBAR_PADDING); + gtk_box_pack_start(GTK_BOX(browser->statusbar), + GTK_WIDGET(browser->statuslabel), + FALSE, + FALSE, + BADWOLF_STATUSBAR_PADDING); + gtk_widget_set_halign(browser->statusbar, GTK_ALIGN_START); - gtk_label_set_single_line_mode(GTK_LABEL(browser->statusbar), TRUE); + + gtk_label_set_single_line_mode(GTK_LABEL(browser->statuslabel), TRUE); gtk_entry_set_text(GTK_ENTRY(browser->location), target_url); gtk_entry_set_has_frame(GTK_ENTRY(browser->location), FALSE); @@ -428,14 +452,8 @@ void closeCb_clicked(GtkButton *close, gpointer user_data) { (void)close; struct Client *browser = (struct Client *)user_data; - GtkNotebook *notebook = GTK_NOTEBOOK(browser->window->notebook); - GValue position = G_VALUE_INIT; - g_value_init(&position, G_TYPE_INT); - gtk_container_child_get_property(GTK_CONTAINER(notebook), browser->box, "position", &position); - - gtk_notebook_remove_page(notebook, g_value_get_int(&position)); - free(browser); + webkit_web_view_try_close(browser->webView); } int main(int argc, char *argv[]) diff --git a/config.h b/config.h @@ -27,6 +27,9 @@ // BADWOLF_TOOLBAR_PADDING: Amount of padding between toolbar elements #define BADWOLF_TOOLBAR_PADDING 0 +// BADWOLF_STATUSBAR_PADDING: Amount of padding between statusbar elements +#define BADWOLF_STATUSBAR_PADDING 0 + /* BADWOLF_DEFAULT_WIDTH / BADWOLF_DEFAULT_HEIGHT: * Used to define the default width/height of the window, * useful for floating Window Managers, probably useless in tiling ones