commit: 9c11983fadcb5ce3bcf6fbbdb2e3c7dfff09d653
parent: 6c37e90f6b49dbcbdce0cb3b4a522e6b17647d3d
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sat, 12 Oct 2019 06:54:04 +0200
Set WebKitWebExtension directory
Diffstat:
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/badwolf.1 b/badwolf.1
@@ -1,7 +1,7 @@
./" 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
+.Dd 2019-10-31
.Dt badwolf 1
.Sh NAME
.Nm badwolf
@@ -12,7 +12,7 @@
.Op Ar URLs or paths
.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.
+is a minimalist browser that cares about privacy, it is based on WebKitGTK and thus also accepts WebKitGTK (and dependencies) flags and environment variables, unfortunately there doesn't seems to be manpages for theses.
.Pp
Runtime configuration specific to
.Nm
@@ -66,6 +66,14 @@ A colon-separated list in the form lang_COUNTRY where lang is in ISO-639 and COU
.Ic BADWOLF_L10N="en_GB:fr_FR:de_DE" .
When this variable isn't set, spelling isn't activated. A more generic variable name is also intended to be used in the future.
.El
+.Sh FILES
+.Bl -tag -width Ds -compact
+.It Pa ${XDG_DATA_HOME:-$HOME/.local/share}/badwolf/webkit-web-extensions/
+Directory containing the
+.Lk https://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebExtension.html WebKitWebExtensions
+to be loaded into
+.Nm . Note: They aren't the JavaScript-based Web-Extensions supported by Firefox or Chrome, but native code in shared objects using the WebKitGTK API.
+.El
.Sh BUGS
You can submit contributions or tickets to
.Lk https://gitlab.com/lanodan/badwolf
diff --git a/badwolf.c b/badwolf.c
@@ -15,6 +15,8 @@
const gchar *homepage = "https://hacktivis.me/projects/badwolf";
const gchar *version = VERSION;
+gchar *web_extensions_directory;
+
static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data);
static gboolean WebViewCb_web_process_terminated(WebKitWebView *webView,
WebKitWebProcessTerminationReason reason,
@@ -42,7 +44,7 @@ static gboolean WebViewCb_decide_policy(WebKitWebView *web_view,
WebKitPolicyDecision *decision,
WebKitPolicyDecisionType decision_type,
gpointer user_data);
-static void web_contextCb_download_started(WebKitWebContext *context,
+static void web_contextCb_download_started(WebKitWebContext *web_context,
WebKitDownload *download,
gpointer user_data);
static gboolean downloadCb_decide_destination(WebKitDownload *download,
@@ -353,11 +355,11 @@ WebViewCb_decide_policy(WebKitWebView *web_view,
}
static void
-web_contextCb_download_started(WebKitWebContext *context,
+web_contextCb_download_started(WebKitWebContext *web_context,
WebKitDownload *download,
gpointer user_data)
{
- (void)context;
+ (void)web_context;
g_signal_connect(G_OBJECT(download),
"decide-destination",
@@ -500,6 +502,8 @@ new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web
webkit_web_context_set_process_model(web_context,
WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES);
+ webkit_web_context_set_web_extensions_directory(web_context, web_extensions_directory);
+
badwolf_l10n = getenv("BADWOLF_L10N");
if(badwolf_l10n != NULL)
@@ -708,6 +712,8 @@ main(int argc, char *argv[])
bind_textdomain_codeset(PACKAGE, "UTF-8");
textdomain(PACKAGE);
+ gtk_init(&argc, &argv);
+
g_fprintf(stderr, _("Running Badwolf version: %s\n"), version);
g_fprintf(stderr,
_("Buildtime WebKit version: %d.%d.%d\n"),
@@ -720,7 +726,8 @@ main(int argc, char *argv[])
webkit_get_minor_version(),
webkit_get_micro_version());
- gtk_init(&argc, &argv);
+ web_extensions_directory = g_build_filename(g_get_user_data_dir(), "badwolf", "webkit-web-extension", NULL);
+ g_fprintf(stderr, _("webkit-web-extension directory set to: %s\n"), web_extensions_directory);
window->main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
window->notebook = gtk_notebook_new();