This patch writes several letters in the beginning of the title which
represent the current status of boolean options: capital 'I' means
'showing images is enabled', while 'i' means it is disabled. Same for
javascript, plugins, caret browsing,...
I've had several implementations of this for a year or two; I quite like
the idea to see compact representation of what is on/off in that window.
In conjunction with the script/plugin toggle and alternate style style
patches it gives me better control on browsing and makes the web
a bit less broken.
I've never been happy with the implementation, though. In particular, it
is ugly to have redundant place to store and lookup the status of
settings.
--s_
diff -r 51a6d05c2c84 surf.c
--- a/surf.c Mon Mar 26 09:33:42 2012 +0200
+++ b/surf.c Thu May 31 09:52:56 2012 +0200
@@ -63,6 +63,7 @@
static char winid[64];
static char *progname;
static gboolean loadimage = 1, plugin = 1, script = 1;
+static char toggstat[5];
static char *buildpath(const char *path);
static void cleanup(void);
@@ -795,16 +796,35 @@
update(c);
}
+gboolean
+get_togglestat(Client *c){
+ gboolean value;
+ WebKitWebSettings *settings
+ = webkit_web_view_get_settings(c->view);
+
+ toggstat[4] = '\0';
+ g_object_get(G_OBJECT(settings), "auto-load-images", &value, NULL);
+ toggstat[0] = value?'I':'i';
+ g_object_get(G_OBJECT(settings), "enable-scripts", &value, NULL);
+ toggstat[1] = value?'S':'s';
+ g_object_get(G_OBJECT(settings), "enable-plugins", &value, NULL);
+ toggstat[2] = value?'V':'v';
+ g_object_get(G_OBJECT(settings), "enable-caret-browsing", &value, NULL);
+ toggstat[3] = value?'C':'c';
+
+}
+
void
update(Client *c) {
char *t;
+ get_togglestat(c);
if(c->linkhover)
- t = g_strdup(c->linkhover);
- else if(c->progress != 100)
- t = g_strdup_printf("[%i%%] %s", c->progress, c->title);
+ t = g_strdup_printf("%s| %s", toggstat, c->linkhover);
+ else if(c->progress != 100)
+ t = g_strdup_printf("[%i%%] %s| %s", c->progress, toggstat,
c->title);
else
- t = g_strdup(c->title);
+ t = g_strdup_printf("%s| %s", toggstat, c->title);
drawindicator(c);
gtk_window_set_title(GTK_WINDOW(c->win), t);
g_free(t);