diff -r 36f57673edf0 config.def.h --- a/config.def.h Wed Mar 10 21:38:07 2010 +0100 +++ b/config.def.h Mon Mar 22 18:45:45 2010 +0100 @@ -7,6 +7,8 @@ static char *cookiefile = ".surf/cookies.txt"; static char *dldir = ".surf/dl/"; static time_t sessiontime = 3600; +static gboolean enable_plugins = FALSE; /* do not load plugins, for instance flash on program start */ +static gboolean auto_load_images = TRUE; /* do load images per default */ #define SETPROP(p) { .v = (char *[]){ "/bin/sh", "-c", \ "prop=\"`xprop -id $1 $0 | cut -d '\"' -f 2 | dmenu`\" &&" \ @@ -18,6 +20,8 @@ { MODKEY|GDK_SHIFT_MASK,GDK_r, reload, { .b = TRUE } }, { MODKEY, GDK_r, reload, { .b = FALSE } }, { MODKEY|GDK_SHIFT_MASK,GDK_p, print, { 0 } }, + { MODKEY, GDK_f, toggleflash,{ 0 } }, + { MODKEY, GDK_i, toggleimages,{ 0 } }, { MODKEY, GDK_p, clipboard, { .b = TRUE } }, { MODKEY, GDK_y, clipboard, { .b = FALSE } }, { MODKEY|GDK_SHIFT_MASK,GDK_j, zoom, { .i = -1 } }, diff -r 36f57673edf0 surf.c --- a/surf.c Wed Mar 10 21:38:07 2010 +0100 +++ b/surf.c Mon Mar 22 18:45:45 2010 +0100 @@ -104,6 +104,8 @@ static void spawn(Client *c, const Arg *arg); static void stop(Client *c, const Arg *arg); static void titlechange(WebKitWebView *v, WebKitWebFrame* frame, const char* title, Client *c); +static void toggleflash(Client *c, const Arg *arg); +static void toggleimages(Client *c, const Arg *arg); static void update(Client *c); static void updatedownload(WebKitDownload *o, GParamSpec *pspec, Client *c); static void updatewinid(Client *c); @@ -534,6 +536,8 @@ if(!(ua = getenv("SURF_USERAGENT"))) ua = useragent; g_object_set(G_OBJECT(settings), "user-agent", ua, NULL); + g_object_set(G_OBJECT(settings), "enable-plugins", enable_plugins, NULL); + g_object_set(G_OBJECT(settings), "auto-load-images", auto_load_images, NULL); uri = g_strconcat("file://", stylefile, NULL); g_object_set(G_OBJECT(settings), "user-stylesheet-uri", uri, NULL); g_free(uri); @@ -763,6 +767,26 @@ } void +toggleflash(Client *c, const Arg *arg) +{ + WebKitWebSettings *settings = webkit_web_view_get_settings(c->view); + g_object_get(G_OBJECT(settings), "enable_plugins", &enable_plugins, NULL); + enable_plugins = !enable_plugins; + g_object_set(G_OBJECT(settings), "enable-plugins", enable_plugins, NULL); + reload(c, arg); /* required for the settings to be applied */ +} + +void +toggleimages(Client *c, const Arg *arg) +{ + WebKitWebSettings *settings = webkit_web_view_get_settings(c->view); + g_object_get(G_OBJECT(settings), "auto-load-images", &auto_load_images, NULL); + auto_load_images = !auto_load_images; + g_object_set(G_OBJECT(settings), "auto-load-images", auto_load_images, NULL); + reload(c, arg); /* required for the settings to be applied */ +} + +void update(Client *c) { char *t;