+ va_start(ap, jsstr);
+ script = g_strdup_vprintf(jsstr, ap);
+ va_end(ap);
+
+ webkit_web_view_run_javascript(c->view, script, NULL, NULL, NULL);
+ g_free(script);
+}
+
+void
+updatewinid(Client *c)
+{
+ snprintf(winid, LENGTH(winid), "%lu", c->xid);
+}
+
+void
+handleplumb(Client *c, const char *uri)
+{
+ Arg a = (Arg)PLUMB(uri);
+ spawn(c, &a);
+}
+
+void
+newwindow(Client *c, const Arg *a, int noembed)
+{
+ int i = 0;
+ char tmp[64];
+ const char *cmd[26], *uri;
+ const Arg arg = { .v = cmd };
+
+ cmd[i++] = argv0;
+ cmd[i++] = "-a";
+ cmd[i++] = cookiepolicies;
+ cmd[i++] = enablescrollbars ? "-B" : "-b";
+ if (cookiefile && g_strcmp0(cookiefile, "")) {
+ cmd[i++] = "-c";
+ cmd[i++] = cookiefile;
+ }
+ cmd[i++] = enablecache ? "-D" : "-d";
+ if (embed && !noembed) {
+ cmd[i++] = "-e";
+ snprintf(tmp, LENGTH(tmp), "%lu", embed);
+ cmd[i++] = tmp;
+ }
+ cmd[i++] = runinfullscreen ? "-F" : "-f";
+ cmd[i++] = allowgeolocation ? "-G" : "-g";
+ cmd[i++] = loadimages ? "-I" : "-i";
+ cmd[i++] = kioskmode ? "-K" : "-k";
+ cmd[i++] = enablestyle ? "-M" : "-m";
+ cmd[i++] = enableinspector ? "-N" : "-n";
+ cmd[i++] = enableplugins ? "-P" : "-p";
+ if (scriptfile && g_strcmp0(scriptfile, "")) {
+ cmd[i++] = "-r";
+ cmd[i++] = scriptfile;
+ }
+ cmd[i++] = enablescripts ? "-S" : "-s";
+ if (stylefile && g_strcmp0(stylefile, "")) {
+ cmd[i++] = "-t";
+ cmd[i++] = stylefile;
+ }
+ if (fulluseragent && g_strcmp0(fulluseragent, "")) {
+ cmd[i++] = "-u";
+ cmd[i++] = fulluseragent;
+ }
+ if (showxid)
+ cmd[i++] = "-x";
+ /* do not keep zoom level */
+ cmd[i++] = "--";
+ if ((uri = a->v))
+ cmd[i++] = uri;
+ cmd[i] = NULL;
+
+ spawn(c, &arg);
+}
+
+void
+spawn(Client *c, const Arg *a)
+{
+ if (fork() == 0) {
+ if (dpy)
+ close(ConnectionNumber(dpy));
+ setsid();
+ execvp(((char **)a->v)[0], (char **)a->v);
+ fprintf(stderr, "%s: execvp %s", argv0, ((char **)a->v)[0]);
+ perror(" failed");
+ exit(1);