Posts tagged ‘dwm’

DWM: A pretty statusbar

dwm uses xsetroot to pipe text into its statusbar.
By default, the statusbar does not support colours and does not support xbm icons.
You could get this functionality by using third party apps such as dzen with conky.

To get this functionality natively within dwm 6.0:

  • Patch your dwm config with jasonwryan’s statuscolors-6.0
  • Take a look at jasonwryan’s dwm-status script the dzen website for some ideas of what text can be piped
  • Follow Lokaltag’s tutorial to draw symbols into your favourite bitmap font.
  • Look at dzen’s icon packs for some ideas of what can be drawn.

Here’s what my statusbar currently looks like (click for full length image):

For the lazy, here’s how to get the statusbar to look like the above:

  1. Save font as ~/.fonts/terminus2.bdf:
    https://github.com/w0ng/dwm/blob/master/terminus2.bdf
  2. Update font cache:
  3. $ xset +fp ~/.fonts
    # fc-cache -fv
  4. Save script as ~/.dwm-statusbar.bash:
    https://github.com/w0ng/bin/blob/master/dwm-statusbar
  5. Allow script to be executed:
    $ chmod +x ~/.dwm-statusbar.bash
  6. Apply jasonwryan’s statuscolors-6.0 patch
  7. Change font and statuscolors options in dwm/config.h:
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    ...
    /* appearance */
    static const char font[]            = "-*-terminus2-medium-r-*-*-12-*-*-*-*-*-*-*";
    #define NUMCOLORS 6
    static const char colors[NUMCOLORS][ColLast][8] = {
      // border foreground background
      { "#073642", "#657b83", "#002b36" }, // 1 = normal (grey on black)
      { "#b58900", "#eee8d5", "#002b36" }, // 2 = selected (white on black)
      { "#dc322f", "#002b36", "#b58900" }, // 3 = urgent (black on yellow)
      { "#073642", "#839496", "#073642" }, // 4 = lightgrey on brightblack
      { "#073642", "#073642", "#002b36" }, // 5 = brightblack on black
      { "#073642", "#002b36", "#073642" }, // 6 = black on brightblack
    };
    ...
  8. Add statusbar script to ~/.xinitrc:
    ~/.dwm-statusbar.bash &
  9. Restart X

Edit: This appears to be a better solution (I haven’t tried it yet, though): https://bbs.archlinux.org/viewtopic.php?pid=1096029#p1096029