% xmobar - A Minimalistic Text Based Status Bar
% Andrea Rossato, Jose A. Ortega Ruiz
About
=====
xmobar is a minimalistic, text based, status bar. It was originally
designed and implemented by Andrea Rossato to work with [xmonad],
but it's actually window-manager-agnostic.
xmobar was inspired by the [Ion3] status bar, and supports similar
features, like dynamic color management, output templates, and
extensibility through plugins.
This page documents xmobar 0.12 (see [release notes]).
[This is a screen shot] of Andrea's desktop with [xmonad] and xmobar.
[This] is xmobar running under [sawfish], with antialiased fonts. And
[this one] is my desktop with [xmonad] and two instances of xmobar.
[release notes]: http://projects.haskell.org/xmobar/releases.html
[xmonad]: http://xmonad.org
[Ion3]: http://tuomov.iki.fi/software/
[This is a screen shot]: http://haskell.org/sitewiki/images/a/ae/Arossato-config.png
[This]: http://projects.haskell.org/xmobar/xmobar-sawfish.png
[this one]: http://projects.haskell.org/xmobar/xmobar-xmonad.png
Installation
============
## Using cabal-install
Xmobar is available from [Hackage], and you can install it using
`cabal-install`:
cabal install xmobar
See below for a list of optional compilation flags that will enable
some optional plugins. For instance, to install xmobar with all the
bells and whistles, use:
cabal install xmobar --flags="all_extensions"
## From source
If you don't have `cabal-install` installed, you can get its source
from [Github]:
git clone git://github.com/jaor/xmobar
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
## Optional features
You can configure xmobar to include some optional plugins and
features, which are not compiled by default. To that end, you need to
add one or more flags to either the cabal install command or the
configure setup step, as shown in the examples above.
Extensions need additional libraries (listed below) that will be
automatically downloaded and installed if you're using cabal install.
Otherwise, you'll need to install them yourself.
`with_utf8`
: UTF-8 support. Requires the [utf8-string] package.
`with_xft`
: Antialiased fonts. Requires the [X11-xft] package. This option
automatically enables UTF-8.
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"
`with_mpd`
: Enables support for the [MPD] daemon. Requires the [libmpd] package.
`with_inotify`
: Support for inotify in modern linux kernels. This option is needed
for the MBox and Mail plugins to work. Requires the [hinotify]
package.
`with_iwlib`
: Support for wireless cards. Enables the Wireless plugin. No Haskell
library is required, but you will need the [iwlib] C library and
headers in your system (e.g., install `libiw-dev` in Debian-based
systems).
`all_extensions`
: Enables all the extensions above.
Running xmobar
==============
You can now run xmobar with:
xmobar /path/to/config &
or
xmobar &
if you have the default configuration file saved as `~/.xmobarrc`
Configuration
=============
## Quick Start
See [xmobar.config-sample] for an example.
For the output template:
- `%command%` will execute command and print the output. The output
may contain markups to change the characters' color.
- `string` will print `string` with `#FF0000` color
(red).
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
`border`
: TopB, TopBM, BottomB, BottomBM, FullB, FullBM or NoBorder (default).
: TopB, BottomB, FullB take no arguments, and request drawing a
border at the top, bottom or around xmobar's window,
respectively.
: TopBM, BottomBM, FullBM take an integer argument, which is the
margin, in pixels, between the border of the window and the
drawn border.
`borderColor`
: Border color.
`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.
## 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]"
## 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
## 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.
## 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: %"] 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`, `Wireless` (optional), `Memory`, `Swap`, `Cpu`,
`MultiCpu`, `Battery`, `TopProc`, `TopMem`, `DiskU`, `DiskIO`,
`Thermal`, `CpuFreq`, `CoreTemp`, `MPD` (optional), `Mail` (optional),
`MBox` (optional), `Date`, `Uptime`, `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
## 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.
`Uptime Args RefreshRate`
- Aliases to `uptime`
- Args: default monitor arguments (see below). The low and high
thresholds refer to the number of days.
- Variables that can be used with the `-t`/`--template` argument:
`days`, `hours`, `minutes`, `seconds`. The total uptime is the
sum of all those fields. You can set the `-P` argument to "True"
to add units to the display of those numeric fields.
- Default template: `Up: d h m`
`Weather StationID Args RefreshRate`
- Aliases to the Station ID: so `Weather "LIPB" []` can be used in template as `%LIPB%`
- Args: default monitor arguments (see below)
- Variables that can be used with the `-t`/`--template` argument:
`station`, `stationState`, `year`, `month`, `day`, `hour`,
`wind`, `visibility`, `skyCondition`, `tempC`, `tempF`,
`dewPoint`, `rh`, `pressure`
- Default template: `: C, rh % ()`
- Requires `curl` in the `$PATH` to retrieve weather information from
`http://weather.noaa.gov`
`Network Interface Args RefreshRate`
- Aliases to the interface name: so `Network "eth0" []` can be used as
`%eth0%`
- Args: default monitor arguments (see below)
- Variables that can be used with the `-t`/`--template` argument:
`dev`, `rx`, `tx`, `rxbar`, `txbar`
- Default template: `: KB|KB`
`Wireless Interface Args RefreshRate`
- Aliases to the interface name with the suffix "wi": thus, `Wirelss
"wlan0" []` can be used as `%wlan0wi%`
- Args: default monitor arguments (see below)
- Variables that can be used with the `-t`/`--template` argument:
`essid`, `quality`, `qualitybar`
- Default template: ` `
- Requires the C library [iwlib] (part of the wireless tools suite)
installed in your system. In addition, to activate this plugin you
must pass `--flags="with_iwlib"` during compilation.
`Memory Args RefreshRate`
- Aliases to `memory`
- Args: default monitor arguments (see below)
- Variables that can be used with the `-t`/`--template` argument:
`total`, `free`, `buffer`, `cache`, `rest`, `used`,
`usedratio`, `usedbar`, `freebar`
- Default template: `Mem: % (M)`
`Swap Args RefreshRate`
- Aliases to `swap`
- Args: default monitor arguments (see below)
- Variables that can be used with the `-t`/`--template` argument:
`total`, `used`, `free`, `usedratio`
- Default template: `Swap: %`
`Cpu Args RefreshRate`
- Aliases to `cpu`
- Args: default monitor arguments (see below)
- Variables that can be used with the `-t`/`--template` argument:
`total`, `bar`, `user`, `nice`, `system`, `idle`
- Default template: `Cpu: %`
`MultiCpu Args RefreshRate`
- Aliases to `multicpu`
- Args: default monitor arguments (see below)
- Variables that can be used with the `-t`/`--template` argument:
`autototal`, `autobar`, `autouser`, `autonice`,
`autosystem`, `autoidle`, `total`, `bar`, `user`, `nice`,
`system`, `idle`, `total0`, `bar0`, `user0`, `nice0`,
`system0`, `idle0`, ...
The auto* variables automatically detect the number of CPUs on the system
and display one entry for each.
- Default template: `Cpu: %`
`Battery Args RefreshRate`
- Same as `BatteryP ["BAT0", "BAT1", "BAT2"] Args RefreshRate`.
`BatteryP Dirs Args RefreshRate`
- Aliases to `battery`
- Dirs: list of directories in /proc/acpi/battery/ directory where to
look for the `state` and `info` files. Example:
`["BAT0","BAT1","BAT2"]`. Only the first 3 directories will be
searched.
- Args: default monitor arguments (see below), plus the following specif ones:
- `-O`: string for AC "on" status (default: "On")
- `-o`: string for AC "off" status (default: "Off")
- `-L`: low power (`watts`) threshold (default: -12)
- `-H`: high power threshold (default: -10)
- `-l`: color to display power lower than the `-L` threshold
- `-m`: color to display power lower than the `-H` threshold
- `-h`: color to display power highter than the `-H` threshold
- `-p`: color to display positive power (battery charging)
- Variables that can be used with the `-t`/`--template` argument:
`left`, `leftbar`, `timeleft`, `watts`, `acstatus`
- Default template: `Batt: , % / `
- Example (note that you need "--" to separate regular monitor options from
Battery's specific ones):
Run BatteryP ["BAT0"]
["-t", " (%)",
"-L", "10", "-H", "80", "-p", "3",
"--", "-O", "On - ", "-o", "",
"-L", "-15", "-H", "-5",
"-l", "red", "-m", "blue", "-h", "green"]
600
In the above example, the thresholds before the "--" separator
refer to the `` field, while those after the separator affect
how `` is displayed.
`TopProc Args RefreshRate`
- Aliases to `top`
- Args: default monitor arguments (see below). The low and high
thresholds (`-L` and `-H`) denote, for memory entries, the percent
of the process memory over the total amount of memory currently in
use and, for cpu entries, the activity percentage (i.e., the value
of `cpuN`, which takes values between 0 and 100).
- Variables that can be used with the `-t`/`--template` argument:
`no`, `name1`, `cpu1`, `both1`, `mname1`, `mem1`, `mboth1`,
`name2`, `cpu2`, `both2`, `mname2`, `mem2`, `mboth2`, ...
- Default template: ``
- Displays the name and cpu/mem usage of running processes (`bothn`
and `mboth` display both, and is useful to specify an overall
maximum and/or minimum width, using the `-m`/`-M` arguments. `no` gives
the total number of processes.
`TopMem Args RefreshRate`
- Aliases to `topmem`
- Args: default monitor arguments (see below). The low and high
thresholds (`-L` and `-H`) denote the percent of the process memory
over the total amount of memory currently in use.
- Variables that can be used with the `-t`/`--template` argument:
`name1`, `mem1`, `both1`, `name2`, `mem2`, `both2`, ...
- Default template: ``
- Displays the name and RSS (resident memory size) of running
processes (`bothn` displays both, and is useful to specify an
overall maximum and/or minimum width, using the `-m`/`-M` arguments.
`DiskU Disks Args RefreshRate`
- Aliases to `disku`
- Disks: list of pairs of the form (device or mount point, template),
where the template can contain , , , or
, or for total, free, used, free
percentage and used percentage of the given file system capacity.
- Args: default monitor arguments (see below). `-t`/`--template` is ignored.
- Default template: none (you must specify a template for each file system).
- Example:
DiskU [("/", "/"), ("sdb1", "")]
["-L", "20", "-H", "50", "-m", "1", "-p", "3",]
20
`DiskIO Disks Args RefreshRate`
- Aliases to `diskio`
- Disks: list of pairs of the form (device or mount point, template),
where the template can contain , , for total,
read and write speed, respectively.
- Args: default monitor arguments (see below). `-t`/`--template` is ignored.
- Default template: none (you must specify a template for each file system).
- Example:
Disks [("/", " "), ("sdb1", "")] [] 10
`Thermal Zone Args RefreshRate`
- Aliases to the Zone: so `Zone "THRM" []` can be used in template as `%THRM%`
- Args: default monitor arguments (see below)
- Variables that can be used with the `-t`/`--template` argument:
`temp`
- Default template: `Thm: C`
- This plugin works only on sytems with devices having thermal zone.
Check directories in /proc/acpi/thermal_zone for possible values.
- Example:
Run Thermal "THRM" ["-t","iwl4965-temp: C"]
`CpuFreq Args RefreshRate`
- Aliases to `cpufreq`
- Args: default monitor arguments (see below)
- Variables that can be used with the `-t`/`--template` argument:
`cpu0`, `cpu1`, .., `cpuN`
- Default template: `Freq: GHz`
- This monitor requires acpi_cpufreq module to be loaded in kernel
- Example:
Run CpuFreq ["-t", "Freq:|GHz", "-L", "0", "-H", "2",
"-l", "lightblue", "-n","white", "-h", "red"] 50
`CoreTemp Args RefreshRate`
- Aliases to `coretemp`
- Args: default monitor arguments (see below)
- Variables that can be used with the `-t`/`--template` argument:
`core0`, `core1`, .., `coreN`
- Default template: `Temp: C`
- This monitor requires coretemp module to be loaded in kernel
- Example:
Run CoreTemp ["-t", "Temp:|C",
"-L", "40", "-H", "60",
"-l", "lightblue", "-n", "gray90", "-h", "red"] 50
`MPD Args RefreshRate`
- This monitor will only be compiled if you ask for it using the
`with_mpd` flag. It needs [libmpd] 5.0 or later (available on Hackage).
- Aliases to `mpd`
- Args: default monitor arguments (see below). In addition you can provide
`-P`, `-S` and `-Z`, with an string argument, to represent the
playing, stopped and paused states in the `statei` template field,
and `-h`, `-p` and `-x` for the host, port and password (default
host is "localhost", port 6600 and empty password).
- Variables that can be used with the `-t`/`--template` argument:
`bar`, `state`, `statei`, `volume`, `length`
`lapsed`, `remaining`,
`plength` (playlist length), `ppos` (playlist position)
`name`, `artist`, `composer`, `performer`
`album`, `title`, `track`, `file`, `genre`
- Default template: `MPD: `
- Example (note that you need "--" to separate regular monitor options from
MPD's specific ones):
Run MPD ["-t",
" ()