support for changing the background color of the statusbar correctly
authorDieter Plaetinck <dieter@plaetinck.be>
Fri, 8 May 2009 18:01:37 +0000 (20:01 +0200)
committerDieter Plaetinck <dieter@plaetinck.be>
Fri, 8 May 2009 18:01:37 +0000 (20:01 +0200)
CHECKLIST
examples/configs/sampleconfig
examples/configs/sampleconfig-dev
uzbl.c
uzbl.h

index 2ea1a74..b2c7065 100644 (file)
--- a/CHECKLIST
+++ b/CHECKLIST
@@ -37,3 +37,4 @@ Also testers and interested people can use this list to see what uzbl is about,
 * run javascript on curent page through "script" command.
 * variable replacement in user agent.
 * basic keyboard link hilighting (numbering) and following. will be improved more
+* support overriding background color of statusbar and pango markup format to customize the statusbar in terms of which variables, separators, colors, fonts, etc
index 42597e1..2e54e4c 100644 (file)
@@ -14,7 +14,9 @@
 history_handler = /usr/share/uzbl/examples/scripts/history.sh
 download_handler = /usr/share/uzbl/examples/scripts/download.sh
 cookie_handler = /usr/share/uzbl/examples/scripts/cookies.sh
-status_format = <span font_family="monospace" background="#99CCFF"><span background="khaki" foreground="black">MODE</span> [<span background="red" foreground="white">KEYCMD</span>] LOAD_PROGRESSBAR [<span foreground="darkgreen">URI</span>] [<span foreground="#000099">NAME</span>]</span>
+status_format = <span font_family="monospace"><span background="khaki" foreground="black">MODE</span> [<span background="red" foreground="white">KEYCMD</span>] LOAD_PROGRESSBAR [<span foreground="darkgreen">URI</span>] [<span foreground="#000099">NAME</span>]</span>
+# you can optionally use this setting to override the background color of the statusbar from your GTK theme.
+status_background = #99CCFF
 fifo_dir = /tmp
 socket_dir = /tmp
 always_insert_mode = 0
index 2e889ed..f6ee9f2 100644 (file)
@@ -20,7 +20,9 @@ always_insert_mode = 0
 modkey = Mod1
 show_status = 1
 status_top = 0
-status_format = <span font_family="monospace" background="#99CCFF"><span background="khaki" foreground="black">MODE</span> [<span background="red" foreground="white">KEYCMD</span>] LOAD_PROGRESSBAR [<span foreground="darkgreen">URI</span>] [<span foreground="#000099">NAME</span>]</span>
+status_format = <span font_family="monospace"><span background="khaki" foreground="black">MODE</span> [<span background="red" foreground="white">KEYCMD</span>] LOAD_PROGRESSBAR [<span foreground="darkgreen">URI</span>] [<span foreground="#000099">NAME</span>]</span>
+# you can optionally use this setting to override the background color of the statusbar from your GTK theme.
+status_background = #99CCFF
 
 [bindings]
 # scroll down/up/left/right
diff --git a/uzbl.c b/uzbl.c
index 1e7ee49..975cf62 100644 (file)
--- a/uzbl.c
+++ b/uzbl.c
@@ -833,8 +833,15 @@ update_title (void) {
 
     if (b->show_status) {
         gtk_window_set_title (GTK_WINDOW(uzbl.gui.main_window), title_short);
+        // TODO: we should probably not do this every time we want to update the title..?
         statln = parse_status_template(uzbl.behave.status_format);
         gtk_label_set_markup(GTK_LABEL(uzbl.gui.mainbar_label), statln);
+        if (b->status_background) {
+            GdkColor color;
+            gdk_color_parse (b->status_background, &color);
+            //labels and hboxes do not draw their own background.  applying this on the window is ok as we the statusbar is the only affected widget.  (if not, we could also use GtkEventBox)
+            gtk_widget_modify_bg (uzbl.gui.main_window, GTK_STATE_NORMAL, &color);
+        }
         g_free(statln);
     } else {
         gtk_window_set_title (GTK_WINDOW(uzbl.gui.main_window), title_long);
@@ -1065,9 +1072,10 @@ settings_init () {
         b->show_status        = g_key_file_get_boolean (config, "behavior", "show_status",        NULL);
         b->modkey             = g_key_file_get_value   (config, "behavior", "modkey",             NULL);
         b->status_top         = g_key_file_get_boolean (config, "behavior", "status_top",         NULL);
-        b->status_format      = g_key_file_get_string (config, "behavior", "status_format",         NULL);
+        b->status_format      = g_key_file_get_string  (config, "behavior", "status_format",      NULL);
+        b->status_background  = g_key_file_get_string  (config, "behavior", "status_background",  NULL);
         if (! b->fifo_dir)
-            b->fifo_dir       = g_key_file_get_value  (config, "behavior", "fifo_dir",           NULL);
+            b->fifo_dir       = g_key_file_get_value   (config, "behavior", "fifo_dir",           NULL);
         if (! b->socket_dir)
             b->socket_dir     = g_key_file_get_value   (config, "behavior", "socket_dir",         NULL);
         keys                  = g_key_file_get_keys    (config, "bindings", NULL,                 NULL);
diff --git a/uzbl.h b/uzbl.h
index ea99003..71ec587 100644 (file)
--- a/uzbl.h
+++ b/uzbl.h
@@ -87,7 +87,8 @@ typedef struct {
 
 /* behaviour */
 typedef struct {
-    gchar    *status_format;
+    gchar*   status_format;
+    gchar*   status_background;
     gchar*   history_handler;
     gchar*   fifo_dir;
     gchar*   socket_dir;