+static void
+toggle(Client *c, const Arg *arg) {
+ WebKitWebSettings *settings;
+ char *name = (char *)arg->v;
+ gboolean value;
+ Arg a = { .b = FALSE };
+
+ settings = webkit_web_view_get_settings(c->view);
+ g_object_get(G_OBJECT(settings), name, &value, NULL);
+ g_object_set(G_OBJECT(settings), name, !value, NULL);
+
+ reload(c, &a);
+}
+
+static void
+togglecookiepolicy(Client *c, const Arg *arg) {
+ SoupCookieJar *jar;
+ SoupCookieJarAcceptPolicy policy;
+
+ jar = SOUP_COOKIE_JAR(
+ soup_session_get_feature(
+ webkit_get_default_session(),
+ SOUP_TYPE_COOKIE_JAR));
+ g_object_get(G_OBJECT(jar), "accept-policy", &policy, NULL);
+
+ policysel++;
+ if(policysel >= strlen(cookiepolicies))
+ policysel = 0;
+
+ g_object_set(G_OBJECT(jar), "accept-policy",
+ cookiepolicy_get(), NULL);
+
+ updatetitle(c);
+ /* Do not reload. */
+}
+
+static void
+togglegeolocation(Client *c, const Arg *arg) {
+ Arg a = { .b = FALSE };
+
+ allowgeolocation ^= 1;
+
+ reload(c, &a);
+}
+
+static void
+twitch(Client *c, const Arg *arg) {
+ GtkAdjustment *a;
+ gdouble v;
+
+ a = gtk_scrolled_window_get_vadjustment(
+ GTK_SCROLLED_WINDOW(c->scroll));
+
+ v = gtk_adjustment_get_value(a);
+
+ v += arg->i;
+
+ v = MAX(v, 0.0);
+ v = MIN(v, gtk_adjustment_get_upper(a) -
+ gtk_adjustment_get_page_size(a));
+ gtk_adjustment_set_value(a, v);
+}
+
+static void
+togglescrollbars(Client *c, const Arg *arg) {
+ GtkPolicyType vspolicy;
+ Arg a;
+
+ gtk_scrolled_window_get_policy(GTK_SCROLLED_WINDOW(c->scroll), NULL, &vspolicy);
+
+ if(vspolicy == GTK_POLICY_AUTOMATIC) {
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(c->scroll),
+ GTK_POLICY_NEVER, GTK_POLICY_NEVER);
+ } else {
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(c->scroll),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ a.i = +1;
+ twitch(c, &a);
+ a.i = -1;
+ twitch(c, &a);
+ }
+}
+
+static void
+togglestyle(Client *c, const Arg *arg) {
+ WebKitWebSettings *settings;
+ char *uri;
+
+ settings = webkit_web_view_get_settings(c->view);
+ g_object_get(G_OBJECT(settings), "user-stylesheet-uri", &uri, NULL);
+ uri = uri[0] ? g_strdup("") : g_strconcat("file://", stylefile, NULL);
+ g_object_set(G_OBJECT(settings), "user-stylesheet-uri", uri, NULL);
+
+ updatetitle(c);
+}
+
+static void
+gettogglestat(Client *c){
+ gboolean value;
+ char *uri;
+ int p = 0;
+ WebKitWebSettings *settings = webkit_web_view_get_settings(c->view);
+
+ togglestat[p++] = cookiepolicy_set(cookiepolicy_get());
+
+ g_object_get(G_OBJECT(settings), "enable-caret-browsing",
+ &value, NULL);
+ togglestat[p++] = value? 'C': 'c';
+
+ togglestat[p++] = allowgeolocation? 'G': 'g';
+
+ g_object_get(G_OBJECT(settings), "auto-load-images", &value, NULL);
+ togglestat[p++] = value? 'I': 'i';
+
+ g_object_get(G_OBJECT(settings), "enable-scripts", &value, NULL);
+ togglestat[p++] = value? 'S': 's';
+
+ g_object_get(G_OBJECT(settings), "enable-plugins", &value, NULL);
+ togglestat[p++] = value? 'V': 'v';
+
+ g_object_get(G_OBJECT(settings), "user-stylesheet-uri", &uri, NULL);
+ togglestat[p++] = uri[0] ? 'M': 'm';
+
+ togglestat[p] = '\0';
+}
+
+static void
+getpagestat(Client *c) {
+ const char *uri = geturi(c);
+
+ if(strstr(uri, "https://") == uri) {
+ pagestat[0] = c->sslfailed ? 'U' : 'T';
+ } else {
+ pagestat[0] = '-';
+ }
+
+ pagestat[1] = usingproxy ? 'P' : '-';
+ pagestat[2] = '\0';
+
+}
+
+static void
+updatetitle(Client *c) {