]> git.armaanb.net Git - chorizo.git/commitdiff
Tell WebKit where to look for web extensions
authorPeter Hofmann <scm@uninformativ.de>
Sun, 30 Nov 2014 14:12:42 +0000 (15:12 +0100)
committerPeter Hofmann <scm@uninformativ.de>
Sun, 30 Nov 2014 14:12:42 +0000 (15:12 +0100)
README
browser.c

diff --git a/README b/README
index 218e07fd1be363700aca58e6518b52d1f1556648..e105f890b4ba4a2295121b700452b1d8739d05f1 100644 (file)
--- a/README
+++ b/README
@@ -261,6 +261,10 @@ following environment variables:
         Lariza will identify itself with this string. Uses WebKit's
         default value if unset.
 
+    LARIZA_WEB_EXTENSIONS_DIR
+        Sets the directory where WebKit will look for "web extensions".
+        Defaults to "~/.local/share/lariza/web_extensions".
+
     LARIZA_ZOOM
         Zoom level for WebKit viewports. Defaults to 1.0.
 
index cf8d2a05b839154b71a67663fdb2d1535da29028..b73f3178ac56aadceee79b15fc0bb4d8cbd3b68f 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -80,6 +80,7 @@ static gboolean language_is_set = FALSE;
 static gchar *search_text = NULL;
 static gboolean tabbed_automagic = TRUE;
 static gchar *user_agent = NULL;
+static gchar *web_extensions_dir = NULL;
 
 
 void
@@ -516,6 +517,13 @@ grab_environment_configuration(void)
        if (e != NULL)
                user_agent = g_strdup(e);
 
+       e = g_getenv(__NAME_UPPERCASE__"_WEB_EXTENSIONS_DIR");
+       if (e != NULL)
+               web_extensions_dir = g_strdup(e);
+       else
+               web_extensions_dir = g_build_filename(g_get_user_data_dir(), __NAME__,
+                                                     "web_extensions", NULL);
+
        e = g_getenv(__NAME_UPPERCASE__"_ZOOM");
        if (e != NULL)
                global_zoom = atof(e);
@@ -907,6 +915,10 @@ main(int argc, char **argv)
        if (tabbed_automagic && !(cooperative_instances && !cooperative_alone))
                embed = tabbed_launch();
 
+       if (!cooperative_instances || cooperative_alone)
+               webkit_web_context_set_web_extensions_directory(webkit_web_context_get_default(),
+                                                               web_extensions_dir);
+
        if (optind >= argc)
                client_new(home_uri);
        else