xmobar - A Minimalistic Text Based Status Bar

1 About

xmobar is a minimalistic, text based, status bar. It was designed to work with the xmonad Window Manager.

It was inspired by the Ion3 status bar, and supports similar features, like dynamic color management, output templates, and extensibility through plugins.

This is a screen shot of my desktop with xmonad and xmobar.

xmobar supports XFT and UTF-8 locales.

See xmobar.config-sample, distributed with the source code, for a sample configuration.

2 Download

You can get the xmobar source code from Hackage.

To get the darcs source run:

    darcs get http://code.haskell.org/xmobar/

The latest binary can be found here:

http://code.haskell.org/~arossato/xmobar/xmobar-0.9.2.bin

A recent screen shot can be found here:

http://code.haskell.org/~arossato/xmobar/xmobar-0.9.png

Version 0.9 requires Cabal-1.2.x, but should work both with ghc-6.6.1 and ghc-6.8.1.

3 Bug Reports

To submit bug reports you can use the Google code bug tracking system available at the following address:

http://code.google.com/p/xmobar/issues

4 Installation

To install simply run:

    tar xvfz xmobar-0.9
    cd xmobar-0.9

Then run the configure script:

    runhaskell Setup.lhs configure

    # To enable UTF-8 support run:
    runhaskell Setup.lhs configure --flags="with_utf8"

    # To enable both XFT and UTF-8 support run:
    runhaskell Setup.lhs configure --flags="with_xft"

Now you can build the source:

    runhaskell Setup.lhs build
    runhaskell Setup.lhs install # possibly to be run as root

You can now run xmobar with:

    xmobar /path/to/config &

or

    xmobar &

if you have the default configuration file saved as ~/.xmobarrc

5 Utf-8 and Xft Support

xmobar can be compiled with UTF-8 and XFT support. If you want UTF-8 support only, you just need to run the configuration script with the "with_utf" flag:

    runhaskell Setup.lhs configure --flags="with_utf8"

This requires the presence of utf8-string package.

XFT support, which will also enable UTF-8 support, requires the X11-xft package too and is enabled by running the configuration script with the "with_xft" flag:

     runhaskell Setup.lhs configure --flags="with_xft"

Then build xmobar as usual.

To use XFT fonts you need to use the xft: prefix in the font configuration option. For instance:

    font = "xft:Times New Roman-10:italic"

6 Configuration

6.1 Quick Start

See xmobar.config-sample for an example.

For the output template:

Other configuration options:

font

Name of the font to be used. Use the xft: prefix for XFT fonts.

bgColor

Background color.

fgColor

Default font color.

position

Top, TopW, TopSize, Bottom, BottomW, BottomSize or Static (with x, y, width and height).

TopW and BottomW take 2 arguments: an alignment parameter (L for left, C for centered, R for Right) and an integer for the percentage width xmobar window will have in respect to the screen width.

TopSize and BottomSize take 3 arguments: an alignment parameter, an integer for the percentage width, and an integer for the minimum pixel height that the xmobar window will have.

For example:

   position = BottomW C 75

to place xmobar at the bottom, centered with the 75% of the screen width.

Or

   position = Static { xpos = 0 , ypos = 0, width = 1024, height = 15 }

or

  position = Top
commands

For setting the options of the programs to run (optional).

sepChar

The character to be used for indicating commands in the output template (default '%').

alignSep

a 2 character string for aligning text in the output template. The text before the first character will be align to left, the text in between the 2 characters will be centered, and the text after the second character will be align to the right.

template

The output template.

6.2 Running xmobar with i3status

xmobar can be used to display information gathered by i3status, a small program that gathers information and formats it suitable for being displayed by the dzen2 status bar, wmii's status bar or xmobar's StdinReader.

Since xmobar support has been added only recently you need to get the git repository, and build it with the appropriate flags:

git clone git://code.stapelberg.de/i3status

and then build it:

cd i3status
make EXTRA_CFLAGS="-DXMOBAR

Then you can run it with:

./i3status -c i3status.conf | xmobar -o -t "%StdinReader%" -c "[Run StdinReader]"

6.3 Command Line Options

xmobar can be either configured with a configuration file or with command line options. In the second case, the command line options will overwrite the corresponding options set in the configuration file.

Example:

xmobar -B white -a right -F blue -t '%LIPB%' -c '[Run Weather "LIPB" [] 36000]'

This is the list of command line options (the output of xmobar --help):

Usage: xmobar [OPTION...] [FILE]
Options:
  -h, -?        --help               This help
  -V            --version            Show version information
  -f font name  --font=font name     The font name
  -B bg color   --bgcolor=bg color   The background color. Default black
  -F fg color   --fgcolor=fg color   The foreground color. Default grey
  -o            --top                Place xmobar at the top of the screen
  -b            --bottom             Place xmobar at the bottom of the screen
  -a alignsep   --alignsep=alignsep  Separators for left, center and right text
                                     alignment. Default: '}{'
  -s char       --sepchar=char       The character used to separate commands in
                                     the output template. Default '%'
  -t template   --template=template  The output template
  -c commands   --commands=commands  The list of commands to be executed
  -x screen     --screen=screen      On which X screen number to start
Mail bug reports and suggestions to <andrea.rossato@unibz.it>

6.4 The Output Template

The output template must contain at least one command. xmobar will parse the template and will search for the command to be executed in the commands configuration option. First an alias will be searched (plugins such as Weather or Network have default aliases, see below). After that, the command name will be tried. If a command is found, the arguments specified in the commands list will be used.

If no command is found in the commands list, xmobar will ask the operating system to execute a program with the name found in the template. If the execution is not successful an error will be reported.

6.5 The commands Configuration Option

The commands configuration option is a list of commands information and arguments to be used by xmobar when parsing the output template. Each member of the list consists in a command prefixed by the Run keyword. Each command has arguments to control the way xmobar is going to execute it.

The option consists in a list of commands separated by a comma and enclosed by square parenthesis.

Example:

[Run Memory ["-t","Mem: <usedratio>%"] 10, Run Swap [] 10]

to run the Memory monitor plugin with the specified template, and the swap monitor plugin, with default options, every second.

The only internal available command is Com (see below Executing External Commands). All other commands are provided by plugins. xmobar comes with some plugins, providing a set of system monitors, a standard input reader, an Unix named pipe reader, and a configurable date plugin. These plugins install the following internal commands: Weather, Network, Memory, Swap, Cpu, MultiCpu, Battery, Thermal, CpuFreq, CoreTemp, Date, StdinReader, CommandReader, and PipeReader.

To remove them see below Installing/Removing a Plugin

Other commands can be created as plugins with the Plugin infrastructure. See below Writing a Plugin

6.6 System Monitor Plugins

This is the description of the system monitor plugins that are installed by default.

Each monitor has an alias to be used in the output template. Monitors have default aliases.

Weather StationID Args RefreshRate

Network Interface Args RefreshRate

Wireless Interface Args RefreshRate

Memory Args RefreshRate

Swap Args RefreshRate

Cpu Args RefreshRate

MultiCpu Args RefreshRate

Battery Args RefreshRate

BatteryP Dirs Args RefreshRate

TopProc Args RefreshRate

TopMem Args RefreshRate

DiskU Disks Args RefreshRate

DiskIO Disks Args RefreshRate

Thermal Zone Args RefreshRate

CpuFreq Args RefreshRate

CoreTemp Args RefreshRate

MPD Args RefreshRate