[hackers] [surf] Add a toggle command for the stylefile. || Christoph Lohmann

From: <git_AT_suckless.org>
Date: Sat, 16 Feb 2013 16:20:44 +0100

commit bd5bbb7fc352a4f1f5c54731e6c8ef01ff91d002
Author: Christoph Lohmann <20h_AT_r-36.net>
Date: Sat Feb 16 16:18:05 2013 +0100

    Add a toggle command for the stylefile.
    
    The patch adds some better formatting for the manpage too.
    
    Thanks to Nick <suckless-dev_AT_njw.me.uk> for the toggle patch!

diff --git a/config.def.h b/config.def.h
index da5a08f..bbfb1ed 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -83,5 +83,6 @@ static Key keys[] = {
     { MODKEY|GDK_SHIFT_MASK,GDK_i, toggle, { .v = "auto-load-images" } },
     { MODKEY|GDK_SHIFT_MASK,GDK_s, toggle, { .v = "enable-scripts" } },
     { MODKEY|GDK_SHIFT_MASK,GDK_v, toggle, { .v = "enable-plugins" } },
+ { MODKEY|GDK_SHIFT_MASK,GDK_m, togglestyle,{ 0 } },
 };
 
diff --git a/surf.1 b/surf.1
index 880a2ad..1bad494 100644
--- a/surf.1
+++ b/surf.1
_AT_@ -18,10 +18,13 @@ one can point surf to another URI by setting its XProperties.
 .SH OPTIONS
 .TP
 .B \-c cookiefile
-Specify the cookiefile to use.
+Specify the
+.I cookiefile
+to use.
 .TP
 .B \-e xid
-Reparents to window specified by xid.
+Reparents to window specified by
+.I xid.
 .TP
 .B \-i
 Disable Images
_AT_@ -33,16 +36,20 @@ Disable the Web Inspector (Developer Tools).
 Disable Plugins
 .TP
 .B \-r scriptfile
-Specify the user scriptfile.
+Specify the user
+.I scriptfile.
 .TP
 .B \-s
 Disable Javascript
 .TP
 .B \-t stylefile
-Specify the user stylefile.
+Specify the user
+.I stylefile.
 .TP
 .B \-u useragent
-Specify the useragent which surf should use.
+Specify the
+.I useragent
+which surf should use.
 .TP
 .B \-v
 Prints version information to standard output, then exits.
_AT_@ -129,6 +136,11 @@ Toggle caret browsing.
 .B Ctrl\-Shift\-i
 Toggle auto-loading of images.
 .TP
+.B Ctrl\-Shift\-m
+Toggle if the
+.I stylefile
+file should be loaded.
+.TP
 .B Ctrl\-Shift\-s
 Toggle script execution.
 .TP
_AT_@ -139,7 +151,9 @@ Toggle the enabling of plugins on that surf instance.
 Toggle fullscreen mode.
 .SH ENVIRONMENT
 .B SURF_USERAGENT
-If this variable is set upon startup, surf will use it as the useragent string
+If this variable is set upon startup, surf will use it as the
+.I useragent
+string
 .TP
 .B http_proxy
 If this variable is set and not empty upon startup, surf will use it as the http proxy
diff --git a/surf.c b/surf.c
index 17f7750..fc61381 100644
--- a/surf.c
+++ b/surf.c
_AT_@ -77,7 +77,7 @@ static GdkNativeWindow embed = 0;
 static gboolean showxid = FALSE;
 static char winid[64];
 static gboolean usingproxy = 0;
-static char togglestat[5];
+static char togglestat[6];
 static char pagestat[3];
 
 static void beforerequest(WebKitWebView *w, WebKitWebFrame *f,
_AT_@ -153,6 +153,7 @@ static void stop(Client *c, const Arg *arg);
 static void titlechange(WebKitWebView *v, WebKitWebFrame *frame,
                 const char *title, Client *c);
 static void toggle(Client *c, const Arg *arg);
+static void togglestyle(Client *c, const Arg *arg);
 static void update(Client *c);
 static void updatewinid(Client *c);
 static void usage(void);
_AT_@ -1038,6 +1039,7 @@ toggle(Client *c, const Arg *arg) {
 static void
 gettogglestat(Client *c){
         gboolean value;
+ char *uri;
         WebKitWebSettings *settings = webkit_web_view_get_settings(c->view);
 
         g_object_get(G_OBJECT(settings), "enable-caret-browsing",
_AT_@ -1053,7 +1055,10 @@ gettogglestat(Client *c){
         g_object_get(G_OBJECT(settings), "enable-plugins", &value, NULL);
         togglestat[3] = value? 'V': 'v';
 
- togglestat[4] = '
Received on Sat Feb 16 2013 - 16:20:44 CET

This archive was generated by hypermail 2.3.0 : Thu Feb 21 2013 - 19:27:05 CET