Hi,

as the bar contains system information which one might want to see at a quick
glance, a bigger font is good. However, setting a bigger font is only possible
with increasing the overall font - which is not necessarily desirable.

The attached patch from Maik Fischer fixes this by adding a new configuration
item called barfont. It behaves like font in /ctl.

Best regards,
Michael
diff -r f5a7f9c6c5ac cmd/wmii/bar.c
--- a/cmd/wmii/bar.c    Sun Feb 01 07:50:57 2009 -0500
+++ b/cmd/wmii/bar.c    Wed Feb 04 14:05:20 2009 +0100
@@ -20,7 +20,7 @@
        }
 
        s->brect = s->r;
-       s->brect.min.y = s->brect.max.y - labelh(def.font);
+       s->brect.min.y = s->brect.max.y - labelh(def.barfont);
 
        wa.override_redirect = 1;
        wa.background_pixmap = ParentRelative;
@@ -42,7 +42,7 @@
 bar_resize(WMScreen *s) {
 
        s->brect = s->r;
-       s->brect.min.y = s->r.max.y - labelh(def.font);
+       s->brect.min.y = s->r.max.y - labelh(def.barfont);
        reshapewin(s->barwin, s->brect);
        /* FIXME: view_arrange. */
 }
@@ -126,9 +126,9 @@
        foreach_bar(s, b) {
                b->r.min = ZP;
                b->r.max.y = Dy(s->brect);
-               b->r.max.x = def.font->height & ~1;
+               b->r.max.x = def.barfont->height & ~1;
                if(b->text && strlen(b->text))
-                       b->r.max.x += textwidth(def.font, b->text);
+                       b->r.max.x += textwidth(def.barfont, b->text);
                width += Dx(b->r);
        }
 
@@ -174,7 +174,7 @@
                if(b == s->bar[BRight])
                        align = East;
                fill(disp.ibuf, b->r, b->col.bg);
-               drawstring(disp.ibuf, def.font, b->r, align, b->text, 
b->col.fg);
+               drawstring(disp.ibuf, def.barfont, b->r, align, b->text, 
b->col.fg);
                border(disp.ibuf, b->r, 1, b->col.border);
        }
        copyimage(s->barwin, r, disp.ibuf, ZP);
diff -r f5a7f9c6c5ac cmd/wmii/dat.h
--- a/cmd/wmii/dat.h    Sun Feb 01 07:50:57 2009 -0500
+++ b/cmd/wmii/dat.h    Wed Feb 04 14:05:20 2009 +0100
@@ -18,6 +18,7 @@
 #include <x11.h>
 
 #define FONT           "-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*"
+#define BARFONT                "-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*"
 #define FOCUSCOLORS    "#ffffff #335577 #447799"
 #define NORMCOLORS     "#222222 #eeeeee #666666"
 
@@ -308,6 +309,7 @@
        CTuple  focuscolor;
        CTuple  normcolor;
        Font*   font;
+       Font*   barfont;
        char*   keys;
        uint    keyssz;
        Ruleset tagrules;
diff -r f5a7f9c6c5ac cmd/wmii/main.c
--- a/cmd/wmii/main.c   Sun Feb 01 07:50:57 2009 -0500
+++ b/cmd/wmii/main.c   Wed Feb 04 14:05:20 2009 +0100
@@ -396,6 +396,7 @@
        def.border = 1;
        def.colmode = Colstack;
        def.font = loadfont(FONT);
+       def.barfont = loadfont(BARFONT);
        def.incmode = ISqueeze;
 
        def.mod = Mod1Mask;
diff -r f5a7f9c6c5ac cmd/wmii/message.c
--- a/cmd/wmii/message.c        Sun Feb 01 07:50:57 2009 -0500
+++ b/cmd/wmii/message.c        Wed Feb 04 14:05:20 2009 +0100
@@ -27,6 +27,7 @@
        LFULLSCREEN,
        LURGENT,
        LBAR,
+       LBARFONT,
        LBORDER,
        LCLIENT,
        LCOLMODE,
@@ -60,6 +61,7 @@
        "Fullscreen",
        "Urgent",
        "bar",
+       "barfont",
        "border",
        "client",
        "colmode",
@@ -457,6 +459,17 @@
                        s = msg_getword(m);
                if(!setdef(&screen->barpos, s, barpostab, nelem(barpostab)))
                        return Ebadvalue;
+               view_update(selview);
+               break;
+       case LBARFONT:
+               fn = loadfont(m->pos);
+               if(fn) {
+                       freefont(def.barfont);
+                       def.barfont = fn;
+                       for(n=0; n < nscreens; n++)
+                               bar_resize(screens[n]);
+               }else
+                       ret = "can't load font";
                view_update(selview);
                break;
        case LBORDER:

Attachment: pgpqiwSFN6kcU.pgp
Description: PGP signature

Reply via email to