Hello there,
I've seen a flash-toggling patch some time ago here, though it wasn't
compatibile with the latest hg pull, I've simplified it a bit, and it
now works like a charm. How about adding it to werc? Some javascript
solution will probably be more elegant, but I don't know anything about
it and for me, in today's web, ability to get rid of this silly plugins
is more than obligatory.
Hope You'll like it.
Regards,
Ted
diff -r ca6a33025ebd config.def.h
--- a/config.def.h Mon Sep 21 19:28:39 2009 +0200
+++ b/config.def.h Sun Sep 27 13:37:38 2009 +0200
@@ -11,6 +11,7 @@
{ 0, GDK_Escape, hidesearch, { 0 }, Any },
{ 0, GDK_Escape, hideurl, { 0 }, Any },
{ MODKEY|GDK_SHIFT_MASK,GDK_p, print, { 0 }, Any },
+ { MODKEY, GDK_f, toggleflash,{ 0 }, Any },
{ MODKEY, GDK_p, clipboard, { .b = TRUE }, Browser },
{ MODKEY, GDK_y, clipboard, { .b = FALSE }, Browser },
{ MODKEY|GDK_SHIFT_MASK,GDK_j, zoom, { .i = -1 }, Browser },
diff -r ca6a33025ebd surf.c
--- a/surf.c Mon Sep 21 19:28:39 2009 +0200
+++ b/surf.c Sun Sep 27 13:37:38 2009 +0200
@@ -109,6 +109,7 @@
static void showurl(Client *c, const Arg *arg);
static void stop(Client *c, const Arg *arg);
static void titlechange(WebKitWebView* view, WebKitWebFrame* frame, const gchar* title, Client *c);
+static void toggleflash(Client *c, const Arg *arg);
static gboolean unfocusbar(GtkWidget *w, GdkEventFocus *e, Client *c);
static void usage(void);
static void update(Client *c);
@@ -451,6 +452,7 @@
gdk_window_add_filter(GTK_WIDGET(c->win)->window, processx, c);
webkit_web_view_set_full_content_zoom(c->view, TRUE);
settings = webkit_web_view_get_settings(c->view);
+ g_object_set(G_OBJECT(settings), "enable-plugins", FALSE, NULL);
g_object_set(G_OBJECT(settings), "user-agent", "surf", NULL);
filename = g_build_filename(workdir, "style.css", NULL);
filename = g_strdup_printf("file://%s", filename);
@@ -663,6 +665,15 @@
update(c);
}
+void
+toggleflash(Client *c, const Arg *arg) {
+ static int flash = 0;
+ WebKitWebSettings *settings;
+ settings = webkit_web_view_get_settings(c->view);
+ g_object_set(G_OBJECT(settings), "enable-plugins", !flash, NULL);
+ (flash) ? (flash = 0) : (flash = 1);
+}
+
gboolean
unfocusbar(GtkWidget *w, GdkEventFocus *e, Client *c) {
hidesearch(c, NULL);