packages feed

xmobar 0.14 → 0.15

raw patch · 28 files changed

+1767/−1520 lines, 28 filesdep +dbus-coredep +textdep −old-timedep ~X11dep ~X11-xftdep ~hinotify

Dependencies added: dbus-core, text

Dependencies removed: old-time

Dependency ranges changed: X11, X11-xft, hinotify, libmpd, mtl, parsec, stm, timezone-olson, timezone-series, utf8-string

Files

− NEWS
@@ -1,150 +0,0 @@-% xmobar - Release notes-% Jose A. Ortega Ruiz--## Version 0.14--_New features_--  - New brightness monitor, courtesy of Martin Perner.-  - New DateZone plugin, for configurable timezone and localized-    datetimes, also by Martin.-  - New keyboard layout monitor (Kbd).  Yes, by Martin.-  - Rewrite of the event handling ([issue 53], [issue 57]), you-    guessed it.-  - Cpu monitor now also reports `iowait` field ([issue 55]).-  - Battery monitor: the full charge file is now settable in the-    monitor arguments (olpc systems use charge_full_design; see [issue 62]).--_Bug fixes_--  - [issue 45]: Fix for crashes with AC status changes in battery monitor.-  - [issue 48]: The <quality> field of Wireless behaves like a percentage.-  - [issue 50]/[issue 61]: `MPD` monitor now works with libmpd 0.6.-  - [issue 60]: Fixes for crashes on power resume for battery monitor.-  - Template sections without fields are now correctly displayed.-  - Catch errors when reading battery status (Ben Boeckel).-  - Compilation issues with ghc 7.x (Sergei Trofimovich).-  - Fixes for CoreTemp monitor in new kernels (Norbert Zeh).-  - Fix for pulseaudio problems in volume monitor (Martin Perner).-  - Fix for parsing errors when a `Run` entry ended in an array-    (Martin).-  - Fixed compilation in OpenBSD (Ivo van der Sangen).--[issue 45]: http://code.google.com/p/xmobar/issues/detail?id=45-[issue 48]: http://code.google.com/p/xmobar/issues/detail?id=48-[issue 50]: http://code.google.com/p/xmobar/issues/detail?id=50-[issue 53]: http://code.google.com/p/xmobar/issues/detail?id=53-[issue 55]: http://code.google.com/p/xmobar/issues/detail?id=55-[issue 57]: http://code.google.com/p/xmobar/issues/detail?id=57-[issue 60]: http://code.google.com/p/xmobar/issues/detail?id=60-[issue 61]: http://code.google.com/p/xmobar/issues/detail?id=61-[issue 62]: http://code.google.com/p/xmobar/issues/detail?id=62--## Version 0.13 (March 28, 2011)--_New features_--  - New `Volume` monitor displaying ALSA soundcards information, by-    Thomas Tuegel.-  - New `ThermalZone` plugin substituting `Thermal` and using linux's-    *sysfs* interface (you need this one if you're using a kernel-    version equal to or above 2.6.37). See [issue 44].-  - xmobar app new has WM_CLASS, WM_NAME and _NET_WM_PID xprops-    ([issue 38]).--_Incompatible changes_--  - In the process of solving [issue 14], we've broken those-    configurations that rely on including alignment separators in the-    input fed to `StdinReader`.-  - The MPD plugin does not accept host and port options anymore: use-    the environment variables MPD_HOST and MPD_PORT instead.-  - The `Mail` plugin now takes a second parameter (a string)-    specifying its alias. As a side-effect, this solves [issue 30].--_Bug fixes_--  - [issue 14]: `StdinReader` and other plugins accepting external-    input don't get confused anymore when characters from `alignSep`-    appear in their input.-  - [issue 27]: `BottomSize` placement now respects its width argument.-  - [issue 28]: Compilation in Mac OS X fixed.-  - [issue 30]: `Mail` plugin can be specified anywhere in commands list.-  - [issue 36]: Battery monitor now supports non-standard locations of-    the `/sys/class/power_supply/AC/online` file.-  - [issue 40]: Battery monitor now supports the new power_now, that-    replaces current_now in linux kernels for v. 2.36 and above.-  - [issue 42]: More accurate net monitor rates.-  - DiskIO, Cpu and MultiCpu monitors are also more accurate now.-  - Text is now correctly centered vertically.-  - `FullBM` border spec fixed.--[issue 14]: http://code.google.com/p/xmobar/issues/detail?id=14-[issue 27]: http://code.google.com/p/xmobar/issues/detail?id=27-[issue 28]: http://code.google.com/p/xmobar/issues/detail?id=28-[issue 30]: http://code.google.com/p/xmobar/issues/detail?id=30-[issue 36]: http://code.google.com/p/xmobar/issues/detail?id=36-[issue 38]: http://code.google.com/p/xmobar/issues/detail?id=38-[issue 40]: http://code.google.com/p/xmobar/issues/detail?id=40-[issue 42]: http://code.google.com/p/xmobar/issues/detail?id=42-[issue 44]: http://code.google.com/p/xmobar/issues/detail?id=44--## Version 0.12 (Dec 24, 2010)--xmobar has a new [maintainer], a new [website], a new [mailing-list] and uses a new [source code repository].--Many thanks to Andrea Rossato, xmobar's author and maintainer so far,-for creating xmobar in the first place, and for giving me the chance-to become its maintainer. And a big thanks to Ben Boeckel, Petr Rockai-and Norbert Zeh for their patches.--[website]: http://projects.haskell.org/xmobar/-[mailing list]: http://projects.haskell.org/cgi-bin/mailman/listinfo/xmobar-[source code repository]: https://github.com/jaor/xmobar-[maintainer]: http://hacks-galore.org/jao/--_New features_--  - Window borders: configuration options `border` and `borderColor`-    allow drawing borders around xmobar's window.-  - New monitor, `Uptime`, showing the system uptime.-  - New monitor argument (`-S`) to enable displaying the `%` symbol in-    percentages or other suffixes (e.g., units in Uptime and Network);-    the symbol is now never included by default.-  - New 'run once' commands, by specifying a 0 refresh rate in `Run-    Com` ([issue 26]).-  - MPD monitor: updated to libmpd 1.5. New fields `ppos` (playlist-    position) and `remaining` (remaining time). New configuration-    options to specify MPD's host, user name and password.-  - Battery monitor: new `watts` and `timeleft` fields (Petr Rockai),-    and specific arguments to control coloring and thresholds of the-    former.-  - MultiCPU monitor: new `auto*` fields that automatically detect all-    present CPUs (Ben Boeckel).-  - CpuFreq monitor uses just one decimal digit for GHz values (Petr-    Rockai).-  - Mail plugin expands paths starting with "~/" (Ben Boeckel). Ditto-    MBox.-  - Weather monitor now skips not retrieved fields, instead of-    displaying a long error message.-  - New compilation flag, `all_extensions`.-  - Documentation and website updates.--_Bug fixes_--  - [issue 23]: Wireless monitor is now compatible with iwlib 29.-  - [issue 24]: Swap monitor's used ratio display fixed.-  - [issue 25]: Percentages only include `%` if requested using `-P`.-  - [issue 31]: MPD monitor now respects `-W` argument.-  - Fixes in CPU frequency formatting, string alignment and colour-    boxes in monitors (Norbert Zeh).-  - TopMem and TopProc now use the `-L` and `-H` options correctly for-    memory template fields.-  - MBox skips non-existent mbox paths instead of hanging.--[issue 23]: http://code.google.com/p/xmobar/issues/detail?id=23-[issue 24]: http://code.google.com/p/xmobar/issues/detail?id=24-[issue 25]: http://code.google.com/p/xmobar/issues/detail?id=25-[issue 26]: http://code.google.com/p/xmobar/issues/detail?id=26-[issue 31]: http://code.google.com/p/xmobar/issues/detail?id=31
− README
@@ -1,1102 +0,0 @@-% xmobar - A Minimalistic Text Based Status Bar--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 usable with any window-manager.--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.14 (see [release notes]).--[This is a screen shot] of Andrea's desktop with [xmonad] and xmobar.-[This screenshot] shows 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 screenshot]: http://projects.haskell.org/xmobar/xmobar-sawfish.png-[this one]: http://projects.haskell.org/xmobar/xmobar-xmonad.png--Bug Reports-===========--To submit bug reports you can use the [bug tracker over at Google-code] or send mail to our [Mailing list].--[bug tracker over at Google code]: http://code.google.com/p/xmobar/issues--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 xmobar's-source code in a variety of ways:--  - From [Hackage]. Just download [xmobar-0.14.tar.gz] from xmobar's-    hackage page.-  - From [Github]. You can also obtain a tarball in [Github's-    downloads page]. You'll find there links to each tagged release.-  - From the bleeding edge repo. If you prefer to live dangerously,-    just get the latest and greatest (and buggiest, i guess) using-    git:-        git clone git://github.com/jaor/xmobar--[xmobar-0.14.tar.gz]: http://hackage.haskell.org/packages/archive/xmobar/0.14/xmobar-0.14.tar.gz-[Github's downloads page]: https://github.com/jaor/xmobar/downloads--To install simply run (if needed):--        tar xvfz xmobar-0.14-        cd xmobar-0.14--If you have cabal installed, you can now use it from within xmobar's-source tree. Otherwise, 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"--        # To enable all extensions-        runhaskell Setup.lhs configure --flags="all_extensions"--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).--`with_alsa`-:    Support for ALSA sound cards. Enables the Volume plugin. Requires the-     [alsa-mixer] package.--`with_datezone`-:    Support for other timezones. Enables the DateZone plugin.-     Requires [timezone-olson] and [timezone-series] package.--`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`--### Signal Handling--Since 0.14 xmobar reacts to SIGUSR1 and SIGUSR2:--- After receiving SIGUSR1 xmobar moves its position to the next screen.--- After receiving SIGUSR2 xmobar repositions it self on the current screen.--Configuration-=============--## Quick Start--See [samples/xmobar.config] for an example.--[samples/xmobar.config]: http://github.com/jaor/xmobar/raw/master/samples/xmobar.config--For the output template:--- `%command%` will execute command and print the output. The output-  may contain markups to change the characters' color.--- `<fc=#FF0000>string</fc>` 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 generated by [i3status], a-small program that gathers system information and outputs it in-formats suitable for being displayed by the dzen2 status bar, wmii's-status bar or xmobar's `StdinReader`.  See [i3status manual] for-further details.--## 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 <xmobar@projects.haskell.org>--## 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: <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, a configurable date-plugin, and much more: we list all available plugins below.--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 `-S` argument to "True"-  to add units to the display of those numeric fields.-- Default template: `Up: <days>d <hours>h <minutes>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: `<station>: <tempC>C, rh <rh>% (<hour>)`-- 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`. Reception and transmission-  rates (`rx` and `tx`) are displayed in Kbytes per second, and you-  can set the `-S` to "True" to make them displayed with units (the-  string "Kb/s").-- Default template: `<dev>: <rx>KB|<tx>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: `<essid> <quality>`-- 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: <usedratio>% (<cache>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: <usedratio>%`--`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`, `iowait`-- Default template: `Cpu: <total>%`--`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: <total>%`--`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)-    - `-f`: file in `/sys/class/power_supply` with AC info (default:-      "AC/online")-    - `-c`: file in `/sys/class/power/<BAT>/` with full charge-    information (default: "charge_full"; for instance, olpc systems-    use "charge_full_design")--- Variables that can be used with the `-t`/`--template` argument:-	    `left`, `leftbar`, `timeleft`, `watts`, `acstatus`-- Default template: `Batt: <watts>, <left>% / <timeleft>`-- Example (note that you need "--" to separate regular monitor options from-  Battery's specific ones):--         Run BatteryP ["BAT0"]-                      ["-t", "<acstatus><watts> (<left>%)",-                       "-L", "10", "-H", "80", "-p", "3",-                       "--", "-O", "<fc=green>On</fc> - ", "-o", "",-                       "-L", "-15", "-H", "-5",-                       "-l", "red", "-m", "blue", "-h", "green",-                       "-c", "charge_full_design"]-                      600-  In the above example, the thresholds before the "--" separator-  refer to the `<left>` field, while those after the separator affect-  how `<watts>` 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: `<both1>`-- 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: `<both1>`-- 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 <size>, <free>, <used>, <freep> or-  <usedp>, <freebar> or <usedbar> 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 [("/", "<used>/<size>"), ("sdb1", "<usedbar>")]-               ["-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 <total>, <read>, <write> 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 [("/", "<read> <write>"), ("sdb1", "<total>")] [] 10--`ThermalZone Number Args RefreshRate`--- Aliases to "thermaln": so `ThermalZone 0 []` can be used in template-  as `%thermal0%`-- Args: default monitor arguments (see below)-- Variables that can be used with the `-t`/`--template` argument:-	    `temp`-- Default template: `<temp>C`-- This plugin works only on sytems with devices having thermal zone.-  Check directories in `/sys/class/thermal` for possible values of the-  zone number (e.g., 0 corresponds to `thermal_zone0` in that-  directory).-- Example:--         Run ThermalZone 0 ["-t","<id>: <temp>C"] 30--`Thermal Zone Args RefreshRate`--- **This plugin is deprecated. Use `ThermalZone` instead.**--- Aliases to the Zone: so `Thermal "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: <temp>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: <temp>C"] 50--`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: <cpu0>GHz`-- This monitor requires acpi_cpufreq module to be loaded in kernel-- Example:--         Run CpuFreq ["-t", "Freq:<cpu0>|<cpu1>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: <core0>C`-- This monitor requires coretemp module to be loaded in kernel-- Example:--         Run CoreTemp ["-t", "Temp:<core0>|<core1>C",-                       "-L", "40", "-H", "60",-                       "-l", "lightblue", "-n", "gray90", "-h", "red"] 50--`Volume Mixer Element Args RefreshRate`--- Aliases to the mixer name and element name separated by a colon. Thus,-  `Volume "default" "Master" [] 10` can be used as `%default:Master%`.-- Args: default monitor arguments (see below). Also accepts:-    - `-O` _string_ On string-        - The string used in place of `<status>` when the mixer element-          is on. Defaults to "[on]".-        - Long option: `--on`-    - `-o` _string_ Off string-        - The string used in place of `<status>` when the mixer element-          is off. Defaults to "[off]".-        - Long option: `--off`-    - `-C` _color_ On color-        - The color to be used for `<status>` when the mixer element-          is on. Defaults to "green".-        - Long option: `--onc`-    - `-c` _color_ Off color-        - The color to be used for `<status>` when the mixer element-          is off. Defaults to "red".-        - Long option: `--offc`-    - `--highd` _number_ High threshold for dB. Defaults to -5.0.-    - `--lowd` _number_ Low threshold for dB. Defaults to -30.0.-- Variables that can be used with the `-t`/`--template` argument:-            `volume`, `volumebar`, `dB`, `status`-- Note that `dB` might only return 0 on your system. This is known-  to happen on systems with a pulseaudio backend.-- Default template: `Vol: <volume>% <status>`-- Requires the package [alsa-core] and [alsa-mixer] installed in your-  system. In addition, to activate this plugin you must pass-  `--flags="with_alsa"` during compilation.--`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.-  The environment variables `MPD_HOST` and `MPD_PORT` are used to configure the-  mpd server to communicate with.-- 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: <state>`-- Example (note that you need "--" to separate regular monitor options from-  MPD's specific ones):--         Run MPD ["-t",-                  "<composer> <title> (<album>) <track>/<plength> <statei> ",-                  "--", "-P", ">>", "-Z", "|", "-S", "><"] 10--`Mail Args Alias`--- Args: list of maildirs in form-  `[("name1","path1"),...]`. Paths may start with a '~'-  to expand to the user's home directory.-- This plugin requires inotify support in your linux kernel and the-  [hinotify] package. To activate, pass `--flags="with_inotify"`-  during compilation.-- Example:--         Run Mail [("inbox", "~/var/mail/inbox"),-                   ("lists", "~/var/mail/lists")]-                  "mail"---`MBox Mboxes Opts Alias`--- Mboxes a list of mbox files of the form `[("name", "path", "color")]`,-  where name is the displayed name, path the absolute or relative (to-  BaseDir) path of the mbox file, and color the color to use to display-  the mail count (use an empty string for the default).-- Opts is a possibly empty list of options, as flags. Possible values:-   -a  --all (no arg)  Show all mailboxes, even if empty.-   -d dir  --dir dir a string giving the base directory where mbox files with-                     a relative path live.-   -p prefix --prefix prefix  a string giving a prefix for the list-                      of displayed mail coints-   -s suffix --suffix suffix  a string giving a suffix for the list-                      of displayed mail coints-- Paths may start with a '~' to expand to the user's home directory.-- This plugin requires inotify support in your linux kernel and the-  [hinotify] package. To activate, pass `--flags="with_inotify"`-  during compilation.-- Example. The following command look for mails in `/var/mail/inbox`-  and `~/foo/mbox`, and will put a space in front of the printed string-  (when it's not empty); it can be used in the template with the alias-  `mbox`:--         Run MBox [("I ", "inbox", "red"), ("O ", "~/foo/mbox", "")]-                  ["-d", "/var/mail/", "-p", " "] "mbox"--`XPropertyLog PropName`--- Aliases to `PropName`-- Reads the X property named by `PropName` (a string) and displays its-  value. The [samples/xmonadpropwrite.hs script] in xmobar's-  distribution can be used to set the given property from the output-  of any other program or script.--[samples/xmonadpropwrite.hs script]: https://github.com/jaor/xmobar/raw/master/samples/xmonadpropwrite.hs--`Brightness Args RefreshRate`--- Aliases to `bright`-- Args: default monitor arguments (see below), plus the following specif ones:-    - `-D`: directory in `/sys/class/backlight/` with files in it-       (default: "acpi_video0")-    - `-C`: file with the current brightness (default:-       actual_brightness)-    - `-M`: file with the maximum brightness (default:-       max_brigtness)-- Variables that can be used with the `-t`/`--template` argument:-	    `hbar`, `percent`, `bar`-- Default template: `<percent>`-- Example:--       Run Brightness ["-t", "<bar>"] 60--`Kbd Opts`--- Registers to XKB/X11-Events and output the currently active keyboard layout.-  Supports replacement of layoutnames.-- Aliases to `kbd`-- Opts is a list of tuple:-    -  first element of the tuple is the search string-    -  second element of the tuple is the corresponding replacement-- Example:--		Run Kbd [("us(dvorak)", "DV"), ("us", "US")]---## Monitor Plugins Commands Arguments--These are the arguments that can be used for internal commands in the-`commands` configuration option:--- `-t` _string_  Output template-    - Template for the monitor output. Field names must be enclosed-      between pointy brackets (`<foo>`) and will be substituted by the-      computed values. You can also specify the foreground (and-      optionally, background) color for a region by bracketing it-      between `<fc=fgcolor>` (or `<fc=fgcolor,bgcolor>`) and-      `</fc>`. The rest of the template is output verbatim.-    - Long option: `--template`-    - Default value: per monitor (see above).-- `-H` _number_ The high threshold.-    - Numerical values higher than _number_ will be displayed with the-      color specified by `-h` (see below).-    - Long option: `--High`-    - Default value: 66-- `-L` _number_ The low threshold.-    - Numerical values higher than _number_ and lower than the high-      threshold will be displayed with the color specified by `-m`-      (see below). Values lower than _number_ will use the `-l` color.-    - Long option: `--Low` - Default value: 80-    - Default value: 33-- `-h` _color_  High threshold color.-    - Color for displaying values above the high threshold. _color_ can-      be either a name (e.g. "blue") or an hexadecimal RGB (e.g.-      "#FF0000").-    - Long option: `--high`-    - Default: none (use the default foreground).-- `-n` _color_  Color for 'normal' values-    - Color used for values greater than the low threshold but lower-      than the high one.-    - Long option: `--normal`-    - Default: none (use the default foreground).-- `-l` _color_  The low threshold color-    - Color for displaying values below the low threshold.-    - Long option: `--low`-    - Default: none (use the default foreground).-- `-S` _boolean_ Display optional suffixes-    - When set to a true designator ("True", "Yes" or "On"), optional-      value suffixes such as the '%' symbol or optional units will be-      displayed.-    - Long option: `--suffix`-    - Default: False.-- `-p` _number_ Percentages padding-    - Width, in number of digits, for quantities representing-      percentages. For instance `-p 3` means that all percentages-      in the monitor will be represented using 3 digits.-    - Long option: `--ppad`-    - Default value: 0 (don't pad)-- `-m` _number_ Minimum field width-    - Minimum width, in number of characters, of the fields in the-      monitor template. Values whose printed representation is shorter-      than this value will be padded using the padding characters-      given by the `-c` option with the alignment specified by `-a`-      (see below).-    - Long option: `--minwidth`-    - Default: 0-- `-M` _number_ Maximum field width-    - Maximum width, in number of characters, of the fields in the-      monitor template. Values whose printed representation is longer-      than this value will be truncated.-    - Long option: `--maxwidth`-    - Default: 0 (no maximum width)-- `-w` _number_ Fixed field width-    - All fields will be set to this width, padding or truncating as-      needed.-    - Long option: `--width`-    - Default: 0 (variable width)-- `-c` _string_-    - Characters used for padding. The characters of _string_ are used-      cyclically. E.g., with `-P +- -w 6`, a field with value "foo"-      will be represented as "+-+foo".-    - Long option: `--padchars`-    - Default value: " "-- `-a` r|l Field alignment-    - Whether to use right (r) or left (l) alignment of field values-      when padding.-    - Long option: `--align`-    - Default value: r (padding to the left)-- `-b` _string_ Bar background-    - Characters used, cyclically, to draw the background of bars.-      For instance, if you set this option to "·.", an empty bar will-      look like this: `·.·.·.·.·.`-    - Long option: `--bback`-    - Default value: ":"-- `-f` _string_ Bar foreground-    - Characters used, cyclically, to draw the foreground of bars.-    - Long option: `--bfore`-    - Default value: "#"-- `-W` _number_ Bar width-    - Total number of characters used to draw bars.-    - Long option: `--bwidth`-    - Default value: 10--Commands' arguments must be set as a list. E.g.:--    Run Weather "EGPF" ["-t", "<station>: <tempC>C"] 36000--In this case xmobar will run the weather monitor, getting information-for the weather station ID EGPF (Glasgow Airport, as a homage to GHC)-every hour (36000 tenth of seconds), with a template that will output-something like:--    Glasgow Airport: 16.0C--## Executing External Commands--In order to execute an external command you can either write the-command name in the template, in this case it will be executed without-arguments, or you can configure it in the "commands" configuration-option list with the Com template command:--`Com ProgramName Args Alias RefreshRate`--- ProgramName: the name of the program-- Args: the arguments to be passed to the program at execution time-- RefreshRate: number of tenths of second between re-runs of the-  command. A zero or negative rate means that the command will be-  executed only once.-- Alias: a name to be used in the template. If the alias is en empty-  string the program name can be used in the template.--E.g.:--        Run Com "uname" ["-s","-r"] "" 0--can be used in the output template as `%uname%` (and xmobar will call-_uname_ only once), while--        Run Com "date" ["+\"%a %b %_d %H:%M\""] "mydate" 600--can be used in the output template as `%mydate%`--## Other Plugins--`StdinReader`--- Aliases to StdinReader-- Displays any text received by xmobar on its standard input.--`Date Format Alias RefreshRate`--- Format is a time format string, as accepted by the standard ISO C-  `strftime` function (or Haskell's `formatCalendarTime`).-- Sample usage: `Run Date "%a %b %_d %Y <fc=#ee9a00>%H:%M:%S</fc>" "date" 10`--`DateZone Format Locale Zone Alias RefreshRate`--- Format is a time format string, as accepted by the standard ISO C-  `strftime` function (or Haskell's `formatCalendarTime`).-- If Locale is "" the default locale of the system is used, otherwise the given-  locale. If there are more instances of DateZone, using "" as input for Locale-  is not recommended.-- Zone is the name of the TimeZone. It is assumed that the tz database is stored-  in /usr/share/zoneinfo/. If "" is given as Zone, the default system time is-  used.-- Sample usage:-  `Run DateZone "%a %H:%M:%S" "de_DE.UTF-8" "Europe/Vienna" "viennaTime" 10`--`CommandReader "/path/to/program" Alias`--- Runs the given program, and displays its standard output.--`PipeReader "/path/to/pipe" Alias`--- Reads its displayed output from the given pipe.--`XMonadLog`--- Aliases to XMonadLog-- Displays information from xmonad's `_XMONAD_LOG`. You can set this-  property by using `xmonadPropLog` as your log hook in xmonad's-  configuration, as in the following example (more info [here]):--        main = do-          spawn "xmobar"-          xmonad $ defaultConfig {-            logHook = dynamicLogString defaultPP >>= xmonadPropLog-          }-   This plugin can be used as a sometimes more convenient alternative-   to `StdinReader`. For instance, it allows you to (re)start xmobar-   outside xmonad.--[here]: http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-DynamicLog.html--Plugins-=======--## Writing a Plugin--Writing a plugin for xmobar should be very simple. You need to create-a data type with at least one constructor.--Next you must declare this data type an instance of the `Exec` class, by-defining the 1 needed method (alternatively `start` or `run`) and 2-optional ones (alias and rate):--        start :: e -> (String -> IO ()) -> IO ()-        run   :: e -> IO String-        rate  :: e -> Int-        alias :: e -> String--`start` must receive a callback to be used to display the `String`-produced by the plugin. This method can be used for plugins that need-to perform asynchronous actions. See `Plugins/PipeReader.hs` for an-example.--`run` can be used for simpler plugins. If you define only `run` the-plugin will be run every second. To overwrite this default you just-need to implement `rate`, which must return the number of tenth of-seconds between every successive runs. See `Plugins/HelloWorld.hs` for-an example of a plugin that runs just once, and `Plugins/Date.hs` for-one that implements `rate`.--Notice that Date could be implemented as:--        instance Exec Date where-            alias (Date _ a _) = a-            start (Date f _ r) = date f r--        date :: String -> Int -> (String -> IO ()) -> IO ()-        date format r callback = do go-            where go = do-                    t <- toCalendarTime =<< getClockTime-                    callback $ formatCalendarTime defaultTimeLocale format t-                    tenthSeconds r >> go--This implementation is equivalent to the one you can read in-`Plugins/Date.hs`.--`alias` is the name to be used in the output template. Default alias-will be the data type constructor.--Implementing a plugin requires importing the plugin API (the `Exec`-class definition), that is exported by `Plugins.hs`. So you just need-to import it in your module with:--        import Plugins--After that your type constructor can be used as an argument for the-Runnable type constructor `Run` in the `commands` list of the-configuration options.--This requires importing your plugin into `Config.hs` and adding your-type to the type list in the type signature of `Config.runnableTypes`.--For a very basic example see `samples/Plugins/HelloWorld.hs` or the-other plugins that are distributed with xmobar.--## Installing/Removing a Plugin--Installing a plugin should require 3 steps. Here we are going to-install the HelloWorld plugin that comes with xmobar, assuming that-you copied it to `src/Plugins`:--1. import the plugin module in `Config.hs`, by adding:--        import Plugins.HelloWorld--2. add the plugin data type to the list of data types in the type-   signature of `runnableTypes` in `Config.hs`. For instance, for the-   HelloWorld plugin, change `runnableTypes` into:--        runnableTypes :: Command :*: Monitors :*: HelloWorld :*: ()-        runnableTypes = undefined--3. Rebuild and reinstall xmobar. Now test it with:--        xmobar Plugins/helloworld.config--As you may see in the example configuration file, the plugin can be-used by adding, in the `commands` list:--        Run HelloWorld--and, in the output template, the alias of the plugin:--        %helloWorld%--That's it.--To remove a plugin, just remove its type from the type signature of-runnableTypes and remove the imported modules.--To remove the system monitor plugin:--1. remove, from `Config.hs`, the line--        import Plugins.Monitors--2. in `Config.hs` change--         runnableTypes :: Command :*: Monitors :*: ()-         runnableTypes = undefined--    to--         runnableTypes :: Command :*: ()-         runnableTypes = undefined--3. rebuild xmobar.--Credits-=======--xmobar [incorporates patches] by Ben Boeckel, Roman Cheplyaka, John-Goerzen, Juraj Hercek, Tomas Janousek, Spencer Janssen, Lennart-Kolmodin, Krzysztof Kosciuszkiewicz, Dmitry Kurochkin, Svein Ove,-Martin Perner, Jens Petersen, Petr Rockai, Andrew Sackville-West,-Alexander Solovyov, Sergei Trofimovich, Thomas Tuegel, Jan Vornberger,-Daniel Wagner and Norbert Zeh.--[incorporates patches]: http://www.ohloh.net/p/xmobar/contributors--__Andrea Rossato__:--Thanks to Robert Manea and Spencer Janssen for their help in-understanding how X works. They gave me suggestions on how to solve-many problems with xmobar.--Thanks to Claus Reinke for make me understand existential types (or at-least for letting me think I grasp existential types...;-).--__jao__:--Thanks to Andrea for creating xmobar in the first place, and for-giving me the chance to contribute.--Useful links-============--- [Github page].-- [Mailing list].-- [xmobar's Ohloh page].--- To understand the internal mysteries of xmobar you may try reading-  [this tutorial] on X Window Programming in Haskell.--- My [sawflibs] project includes a module to automate running xmobar-  in [sawfish].--[xmobar's Ohloh page]: https://www.ohloh.net/p/xmobar-[this tutorial]: http://www.haskell.org/haskellwiki/X_window_programming_in_Haskell-[sawflibs]: http://github.com/jaor/sawflibs--Author-======--Andrea Rossato originally designed and implemented xmobar up to-version 0.11.1. Since then, it is maintained by [Jose Antonio Ortega-Ruiz](http://hacks-galore.org/jao/).--Legal-=====--This software is released under a BSD-style license. See [LICENSE] for-more details.--Copyright &copy; 2007-2010 Andrea Rossato--Copyright &copy; 2010-2011 Jose Antonio Ortega Ruiz--[Github]: http://github.com/jaor/xmobar/-[Github page]: http://github.com/jaor/xmobar-[Hackage]: http://hackage.haskell.org/package/xmobar/-[LICENSE]: https://github.com/jaor/xmobar/raw/master/LICENSE-[Mailing list]: http://projects.haskell.org/cgi-bin/mailman/listinfo/xmobar-[MPD]: http://mpd.wikia.com/-[X11-xft]: http://hackage.haskell.org/package/X11-xft/-[i3status]: http://i3wm.org/i3status/-[i3status manual]: http://i3wm.org/i3status/manpage.html#_using_i3status_with_xmobar-[iwlib]: http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html-[hinotify]: http://hackage.haskell.org/package/hinotify/-[libmpd]: http://hackage.haskell.org/package/libmpd/-[sawfish]: http://sawfish.wikia.com/-[utf8-string]: http://hackage.haskell.org/package/utf8-string/-[alsa-core]: http://hackage.haskell.org/package/alsa-core-[alsa-mixer]: http://hackage.haskell.org/package/alsa-mixer-[timezone-olson]: http://hackage.haskell.org/package/timezone-olson-[timezone-series]: http://hackage.haskell.org/package/timezone-series
+ news.md view
@@ -0,0 +1,189 @@+% xmobar - Release notes++## Version 0.15 (June 4, 2012)++_Incompatible changes_++  - `Batt` monitor no longer uses `-c` to specify the charge file: it+    should figure things out by itself (cf. [issue 69]).++_New features_++  - New command line option, `-C`, that allows *adding* commands to+    those specified in the configuration file (Ben Boeckel).+  - Dependency on GHC's threaded runtime has been eliminated.+  - New MPRIS (versions 1 and 2) monitor, by Artem Tarasov.+  - New monitor option `-d` to specify the number of decimal places to+    display for float numbers.  Defaults to 0. See [issue 58].+  - New compilation option `--with_threaded`, to use GHC's threaded+    runtime to compile xmobar.  Disabled by default (cf. discussion in+    [github #36]).++_Bug fixes_++  - Stricter build dependencies versioning in cabal file.+  - [issue 56]: vertical alignment of text improved.+  - [issue 64]: display of `watts` in `Batt` monitor fixed.+  - [issue 69]: miscellaneous battery reporting issues.+  - [issue 67]: compilation in DragonFly.+  - DiskIO works also when device path in mtab are symbolic links+    to the real device file.+  - Wireless monitor honours padding settings for ESSID names.+  - CoreTemp monitor fixed for newer kernels ([github #38]).++[issue 56]: http://code.google.com/p/xmobar/issues/detail?id=56+[issue 58]: http://code.google.com/p/xmobar/issues/detail?id=58+[issue 64]: http://code.google.com/p/xmobar/issues/detail?id=64+[issue 67]: http://code.google.com/p/xmobar/issues/detail?id=67+[issue 69]: http://code.google.com/p/xmobar/issues/detail?id=69+[github #36]: https://github.com/jaor/xmobar/issues/38+[github #38]: https://github.com/jaor/xmobar/issues/38++## Version 0.14 (Dec 10, 2011)++_New features_++  - New brightness monitor, courtesy of Martin Perner.+  - New DateZone plugin, for configurable timezone and localized+    datetimes, also by Martin.+  - New keyboard layout monitor (Kbd).  Yes, by Martin.+  - Rewrite of the event handling ([issue 53], [issue 57]), you+    guessed it.+  - Cpu monitor now also reports `iowait` field ([issue 55]).+  - Battery monitor: the full charge file is now settable in the+    monitor arguments (olpc systems use `charge_full_design`; see+    [issue 62]).++_Bug fixes_++  - [issue 45]: Fix for crashes with AC status changes in battery monitor.+  - [issue 48]: The <quality> field of Wireless behaves like a percentage.+  - [issue 50]/[issue 61]: `MPD` monitor now works with libmpd 0.6.+  - [issue 60]: Fixes for crashes on power resume for battery monitor.+  - Template sections without fields are now correctly displayed.+  - Catch errors when reading battery status (Ben Boeckel).+  - Compilation issues with ghc 7.x (Sergei Trofimovich).+  - Fixes for CoreTemp monitor in new kernels (Norbert Zeh).+  - Fix for pulseaudio problems in volume monitor (Martin Perner).+  - Fix for parsing errors when a `Run` entry ended in an array+    (Martin).+  - Fixed compilation in OpenBSD (Ivo van der Sangen).++[issue 45]: http://code.google.com/p/xmobar/issues/detail?id=45+[issue 48]: http://code.google.com/p/xmobar/issues/detail?id=48+[issue 50]: http://code.google.com/p/xmobar/issues/detail?id=50+[issue 53]: http://code.google.com/p/xmobar/issues/detail?id=53+[issue 55]: http://code.google.com/p/xmobar/issues/detail?id=55+[issue 57]: http://code.google.com/p/xmobar/issues/detail?id=57+[issue 60]: http://code.google.com/p/xmobar/issues/detail?id=60+[issue 61]: http://code.google.com/p/xmobar/issues/detail?id=61+[issue 62]: http://code.google.com/p/xmobar/issues/detail?id=62++## Version 0.13 (March 28, 2011)++_New features_++  - New `Volume` monitor displaying ALSA soundcards information, by+    Thomas Tuegel.+  - New `ThermalZone` plugin substituting `Thermal` and using linux's+    *sysfs* interface (you need this one if you're using a kernel+    version equal to or above 2.6.37). See [issue 44].+  - xmobar app new has WM_CLASS, WM_NAME and _NET_WM_PID xprops+    ([issue 38]).++_Incompatible changes_++  - In the process of solving [issue 14], we've broken those+    configurations that rely on including alignment separators in the+    input fed to `StdinReader`.+  - The MPD plugin does not accept host and port options anymore: use+    the environment variables MPD_HOST and MPD_PORT instead.+  - The `Mail` plugin now takes a second parameter (a string)+    specifying its alias. As a side-effect, this solves [issue 30].++_Bug fixes_++  - [issue 14]: `StdinReader` and other plugins accepting external+    input don't get confused anymore when characters from `alignSep`+    appear in their input.+  - [issue 27]: `BottomSize` placement now respects its width argument.+  - [issue 28]: Compilation in Mac OS X fixed.+  - [issue 30]: `Mail` plugin can be specified anywhere in commands list.+  - [issue 36]: Battery monitor now supports non-standard locations of+    the `/sys/class/power_supply/AC/online` file.+  - [issue 40]: Battery monitor now supports the new power_now, that+    replaces current_now in linux kernels for v. 2.36 and above.+  - [issue 42]: More accurate net monitor rates.+  - DiskIO, Cpu and MultiCpu monitors are also more accurate now.+  - Text is now correctly centered vertically.+  - `FullBM` border spec fixed.++[issue 14]: http://code.google.com/p/xmobar/issues/detail?id=14+[issue 27]: http://code.google.com/p/xmobar/issues/detail?id=27+[issue 28]: http://code.google.com/p/xmobar/issues/detail?id=28+[issue 30]: http://code.google.com/p/xmobar/issues/detail?id=30+[issue 36]: http://code.google.com/p/xmobar/issues/detail?id=36+[issue 38]: http://code.google.com/p/xmobar/issues/detail?id=38+[issue 40]: http://code.google.com/p/xmobar/issues/detail?id=40+[issue 42]: http://code.google.com/p/xmobar/issues/detail?id=42+[issue 44]: http://code.google.com/p/xmobar/issues/detail?id=44++## Version 0.12 (Dec 24, 2010)++xmobar has a new [maintainer], a new [website], a new [mailing+list] and uses a new [source code repository].++Many thanks to Andrea Rossato, xmobar's author and maintainer so far,+for creating xmobar in the first place, and for giving me the chance+to become its maintainer. And a big thanks to Ben Boeckel, Petr Rockai+and Norbert Zeh for their patches.++[website]: http://projects.haskell.org/xmobar/+[mailing list]: http://projects.haskell.org/cgi-bin/mailman/listinfo/xmobar+[source code repository]: https://github.com/jaor/xmobar+[maintainer]: http://hacks-galore.org/jao/++_New features_++  - Window borders: configuration options `border` and `borderColor`+    allow drawing borders around xmobar's window.+  - New monitor, `Uptime`, showing the system uptime.+  - New monitor argument (`-S`) to enable displaying the `%` symbol in+    percentages or other suffixes (e.g., units in Uptime and Network);+    the symbol is now never included by default.+  - New 'run once' commands, by specifying a 0 refresh rate in `Run+    Com` ([issue 26]).+  - MPD monitor: updated to libmpd 1.5. New fields `ppos` (playlist+    position) and `remaining` (remaining time). New configuration+    options to specify MPD's host, user name and password.+  - Battery monitor: new `watts` and `timeleft` fields (Petr Rockai),+    and specific arguments to control coloring and thresholds of the+    former.+  - MultiCPU monitor: new `auto*` fields that automatically detect all+    present CPUs (Ben Boeckel).+  - CpuFreq monitor uses just one decimal digit for GHz values (Petr+    Rockai).+  - Mail plugin expands paths starting with "~/" (Ben Boeckel). Ditto+    MBox.+  - Weather monitor now skips not retrieved fields, instead of+    displaying a long error message.+  - New compilation flag, `all_extensions`.+  - Documentation and website updates.++_Bug fixes_++  - [issue 23]: Wireless monitor is now compatible with iwlib 29.+  - [issue 24]: Swap monitor's used ratio display fixed.+  - [issue 25]: Percentages only include `%` if requested using `-P`.+  - [issue 31]: MPD monitor now respects `-W` argument.+  - Fixes in CPU frequency formatting, string alignment and colour+    boxes in monitors (Norbert Zeh).+  - TopMem and TopProc now use the `-L` and `-H` options correctly for+    memory template fields.+  - MBox skips non-existent mbox paths instead of hanging.++[issue 23]: http://code.google.com/p/xmobar/issues/detail?id=23+[issue 24]: http://code.google.com/p/xmobar/issues/detail?id=24+[issue 25]: http://code.google.com/p/xmobar/issues/detail?id=25+[issue 26]: http://code.google.com/p/xmobar/issues/detail?id=26+[issue 31]: http://code.google.com/p/xmobar/issues/detail?id=31
+ readme.md view
@@ -0,0 +1,1137 @@+% xmobar - A Minimalistic Text Based Status Bar++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 usable with any window-manager.++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.15 (see [release notes]).++[This screenshot] shows 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 screenshot]: http://projects.haskell.org/xmobar/xmobar-sawfish.png+[this one]: http://projects.haskell.org/xmobar/xmobar-xmonad.png++Bug Reports+===========++To submit bug reports you can use the [bug tracker over at Google+code] or send mail to our [Mailing list].++[bug tracker over at Google code]: http://code.google.com/p/xmobar/issues++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 xmobar's+source code in a variety of ways:++  - From [Hackage]. Just download [xmobar-0.15.tar.gz] from xmobar's+    hackage page.+  - From [Github]. You can also obtain a tarball in [Github's+    downloads page]. You'll find there links to each tagged release.+  - From the bleeding edge repo. If you prefer to live dangerously,+    just get the latest and greatest (and buggiest, i guess) using+    git:+        git clone git://github.com/jaor/xmobar++[xmobar-0.15.tar.gz]: http://hackage.haskell.org/packages/archive/xmobar/0.15/xmobar-0.15.tar.gz+[Github's downloads page]: https://github.com/jaor/xmobar/downloads++To install simply run (if needed):++        tar xvfz xmobar-0.15+        cd xmobar-0.15++If you have cabal installed, you can now use it from within xmobar's+source tree. Otherwise, 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"++        # To enable all extensions+        runhaskell Setup.lhs configure --flags="all_extensions"++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_threaded`+:    Uses GHC's threaded runtime.  Use this option if xmobar enters a+     high-CPU regime right after starting.++`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_mpris`+:    Enables support for MPRIS v1/v2 protocol.+     Requires the [dbus-core] and [text] packages.++`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).++`with_alsa`+:    Support for ALSA sound cards. Enables the Volume plugin. Requires the+     [alsa-mixer] package.++`with_datezone`+:    Support for other timezones. Enables the DateZone plugin.+     Requires [timezone-olson] and [timezone-series] package.++`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`++### Signal Handling++Since 0.14 xmobar reacts to SIGUSR1 and SIGUSR2:++- After receiving SIGUSR1 xmobar moves its position to the next screen.++- After receiving SIGUSR2 xmobar repositions it self on the current screen.++Configuration+=============++## Quick Start++See [samples/xmobar.config] for an example.++[samples/xmobar.config]: http://github.com/jaor/xmobar/raw/master/samples/xmobar.config++For the output template:++- `%command%` will execute command and print the output. The output+  may contain markups to change the characters' color.++- `<fc=#FF0000>string</fc>` 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 generated by [i3status], a+small program that gathers system information and outputs it in+formats suitable for being displayed by the dzen2 status bar, wmii's+status bar or xmobar's `StdinReader`.  See [i3status manual] for+further details.++## 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+      -C command    --add-command=command  Add to the list of commands to be executed+      -x screen     --screen=screen        On which X screen number to start++    Mail bug reports and suggestions to <xmobar@projects.haskell.org>++## 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: <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, a configurable date+plugin, and much more: we list all available plugins below.++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 `-S` argument to "True"+  to add units to the display of those numeric fields.+- Default template: `Up: <days>d <hours>h <minutes>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: `<station>: <tempC>C, rh <rh>% (<hour>)`+- 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`. Reception and transmission+  rates (`rx` and `tx`) are displayed in Kbytes per second, and you+  can set the `-S` to "True" to make them displayed with units (the+  string "Kb/s").+- Default template: `<dev>: <rx>KB|<tx>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: `<essid> <quality>`+- 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: <usedratio>% (<cache>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: <usedratio>%`++### `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`, `iowait`+- Default template: `Cpu: <total>%`++### `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: <total>%`++### `Battery Args RefreshRate`++- Same as `BatteryP ["BAT0", "BAT1", "BAT2"] Args RefreshRate`.++### `BatteryP Dirs Args RefreshRate`++- Aliases to `battery`+- Dirs: list of directories in `/sys/class/power_supply/` where to+  look for the ACPI files of each battery. 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)+    - `-f`: file in `/sys/class/power_supply` with AC info (default:+      "AC/online")++- Variables that can be used with the `-t`/`--template` argument:+	    `left`, `leftbar`, `timeleft`, `watts`, `acstatus`+- Default template: `Batt: <watts>, <left>% / <timeleft>`+- Example (note that you need "--" to separate regular monitor options from+  Battery's specific ones):++         Run BatteryP ["BAT0"]+                      ["-t", "<acstatus><watts> (<left>%)",+                       "-L", "10", "-H", "80", "-p", "3",+                       "--", "-O", "<fc=green>On</fc> - ", "-o", "",+                       "-L", "-15", "-H", "-5",+                       "-l", "red", "-m", "blue", "-h", "green"]+                      600+  In the above example, the thresholds before the "--" separator+  refer to the `<left>` field, while those after the separator affect+  how `<watts>` 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: `<both1>`+- 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: `<both1>`+- 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 <size>, <free>, <used>, <freep> or+  <usedp>, <freebar> or <usedbar> 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 [("/", "<used>/<size>"), ("sdb1", "<usedbar>")]+               ["-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 <total>, <read>, <write> 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 [("/", "<read> <write>"), ("sdb1", "<total>")] [] 10++### `ThermalZone Number Args RefreshRate`++- Aliases to "thermaln": so `ThermalZone 0 []` can be used in template+  as `%thermal0%`+- Args: default monitor arguments (see below)+- Variables that can be used with the `-t`/`--template` argument:+	    `temp`+- Default template: `<temp>C`+- This plugin works only on sytems with devices having thermal zone.+  Check directories in `/sys/class/thermal` for possible values of the+  zone number (e.g., 0 corresponds to `thermal_zone0` in that+  directory).+- Example:++         Run ThermalZone 0 ["-t","<id>: <temp>C"] 30++#### `Thermal Zone Args RefreshRate`++- **This plugin is deprecated. Use `ThermalZone` instead.**++- Aliases to the Zone: so `Thermal "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: <temp>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: <temp>C"] 50++### `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: <cpu0>GHz`+- This monitor requires acpi_cpufreq module to be loaded in kernel+- Example:++         Run CpuFreq ["-t", "Freq:<cpu0>|<cpu1>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: <core0>C`+- This monitor requires coretemp module to be loaded in kernel+- Example:++         Run CoreTemp ["-t", "Temp:<core0>|<core1>C",+                       "-L", "40", "-H", "60",+                       "-l", "lightblue", "-n", "gray90", "-h", "red"] 50++### `Volume Mixer Element Args RefreshRate`++- Aliases to the mixer name and element name separated by a colon. Thus,+  `Volume "default" "Master" [] 10` can be used as `%default:Master%`.+- Args: default monitor arguments (see below). Also accepts:+    - `-O` _string_ On string+        - The string used in place of `<status>` when the mixer element+          is on. Defaults to "[on]".+        - Long option: `--on`+    - `-o` _string_ Off string+        - The string used in place of `<status>` when the mixer element+          is off. Defaults to "[off]".+        - Long option: `--off`+    - `-C` _color_ On color+        - The color to be used for `<status>` when the mixer element+          is on. Defaults to "green".+        - Long option: `--onc`+    - `-c` _color_ Off color+        - The color to be used for `<status>` when the mixer element+          is off. Defaults to "red".+        - Long option: `--offc`+    - `--highd` _number_ High threshold for dB. Defaults to -5.0.+    - `--lowd` _number_ Low threshold for dB. Defaults to -30.0.+- Variables that can be used with the `-t`/`--template` argument:+            `volume`, `volumebar`, `dB`, `status`+- Note that `dB` might only return 0 on your system. This is known+  to happen on systems with a pulseaudio backend.+- Default template: `Vol: <volume>% <status>`+- Requires the package [alsa-core] and [alsa-mixer] installed in your+  system. In addition, to activate this plugin you must pass+  `--flags="with_alsa"` during compilation.++### `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.+  The environment variables `MPD_HOST` and `MPD_PORT` are used to configure the+  mpd server to communicate with.+- 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: <state>`+- Example (note that you need "--" to separate regular monitor options from+  MPD's specific ones):++         Run MPD ["-t",+                  "<composer> <title> (<album>) <track>/<plength> <statei> ",+                  "--", "-P", ">>", "-Z", "|", "-S", "><"] 10++### `Mpris1 PlayerName Args RefreshRate`++- Aliases to `mpris1`+- Requires [dbus-core] and [text] packages.+  To activate, pass `--flags="with_mpris"` during compilation.+- PlayerName: player supporting MPRIS v1 protocol, in lowercase.+- Args: default monitor arguments.+- Variables that can be used with the `-t`/`--template` argument:+            `album`, `artist`, `arturl`, `length`, `title`, `tracknumber`+- Default template: `<artist> - <title>`+- Example:++         Run Mpris1 "clementine" ["-t",+                                  "<artist> - [<tracknumber>] <title>"] 10++### `Mpris2 PlayerName Args RefreshRate`++- Just like Mpris1.+  Supposed to be used with mediaplayers which support MPRIS v2.++### `Mail Args Alias`++- Args: list of maildirs in form+  `[("name1","path1"),...]`. Paths may start with a '~'+  to expand to the user's home directory.+- This plugin requires inotify support in your linux kernel and the+  [hinotify] package. To activate, pass `--flags="with_inotify"`+  during compilation.+- Example:++         Run Mail [("inbox", "~/var/mail/inbox"),+                   ("lists", "~/var/mail/lists")]+                  "mail"++### `MBox Mboxes Opts Alias`++- Mboxes a list of mbox files of the form `[("name", "path", "color")]`,+  where name is the displayed name, path the absolute or relative (to+  BaseDir) path of the mbox file, and color the color to use to display+  the mail count (use an empty string for the default).+- Opts is a possibly empty list of options, as flags. Possible values:+   -a  --all (no arg)  Show all mailboxes, even if empty.+   -d dir  --dir dir a string giving the base directory where mbox files with+                     a relative path live.+   -p prefix --prefix prefix  a string giving a prefix for the list+                      of displayed mail coints+   -s suffix --suffix suffix  a string giving a suffix for the list+                      of displayed mail coints+- Paths may start with a '~' to expand to the user's home directory.+- This plugin requires inotify support in your linux kernel and the+  [hinotify] package. To activate, pass `--flags="with_inotify"`+  during compilation.+- Example. The following command look for mails in `/var/mail/inbox`+  and `~/foo/mbox`, and will put a space in front of the printed string+  (when it's not empty); it can be used in the template with the alias+  `mbox`:++         Run MBox [("I ", "inbox", "red"), ("O ", "~/foo/mbox", "")]+                  ["-d", "/var/mail/", "-p", " "] "mbox"++### `XPropertyLog PropName`++- Aliases to `PropName`+- Reads the X property named by `PropName` (a string) and displays its+  value. The [samples/xmonadpropwrite.hs script] in xmobar's+  distribution can be used to set the given property from the output+  of any other program or script.++[samples/xmonadpropwrite.hs script]: https://github.com/jaor/xmobar/raw/master/samples/xmonadpropwrite.hs++### `NamedXPropertyLog PropName Alias`++- Same as XPropertyLog, but a custom alias can be specified.++### `Brightness Args RefreshRate`++- Aliases to `bright`+- Args: default monitor arguments (see below), plus the following specif ones:+    - `-D`: directory in `/sys/class/backlight/` with files in it+       (default: "acpi_video0")+    - `-C`: file with the current brightness (default:+       actual_brightness)+    - `-M`: file with the maximum brightness (default:+       max_brigtness)+- Variables that can be used with the `-t`/`--template` argument:+	    `hbar`, `percent`, `bar`+- Default template: `<percent>`+- Example:++       Run Brightness ["-t", "<bar>"] 60++### `Kbd Opts`++- Registers to XKB/X11-Events and output the currently active keyboard layout.+  Supports replacement of layoutnames.+- Aliases to `kbd`+- Opts is a list of tuple:+    -  first element of the tuple is the search string+    -  second element of the tuple is the corresponding replacement+- Example:++		Run Kbd [("us(dvorak)", "DV"), ("us", "US")]+++## Monitor Plugins Commands Arguments++These are the arguments that can be used for internal commands in the+`commands` configuration option:++- `-t` _string_  Output template+    - Template for the monitor output. Field names must be enclosed+      between pointy brackets (`<foo>`) and will be substituted by the+      computed values. You can also specify the foreground (and+      optionally, background) color for a region by bracketing it+      between `<fc=fgcolor>` (or `<fc=fgcolor,bgcolor>`) and+      `</fc>`. The rest of the template is output verbatim.+    - Long option: `--template`+    - Default value: per monitor (see above).+- `-H` _number_ The high threshold.+    - Numerical values higher than _number_ will be displayed with the+      color specified by `-h` (see below).+    - Long option: `--High`+    - Default value: 66+- `-L` _number_ The low threshold.+    - Numerical values higher than _number_ and lower than the high+      threshold will be displayed with the color specified by `-m`+      (see below). Values lower than _number_ will use the `-l` color.+    - Long option: `--Low` - Default value: 80+    - Default value: 33+- `-h` _color_  High threshold color.+    - Color for displaying values above the high threshold. _color_ can+      be either a name (e.g. "blue") or an hexadecimal RGB (e.g.+      "#FF0000").+    - Long option: `--high`+    - Default: none (use the default foreground).+- `-n` _color_  Color for 'normal' values+    - Color used for values greater than the low threshold but lower+      than the high one.+    - Long option: `--normal`+    - Default: none (use the default foreground).+- `-l` _color_  The low threshold color+    - Color for displaying values below the low threshold.+    - Long option: `--low`+    - Default: none (use the default foreground).+- `-S` _boolean_ Display optional suffixes+    - When set to a true designator ("True", "Yes" or "On"), optional+      value suffixes such as the '%' symbol or optional units will be+      displayed.+    - Long option: `--suffix`+    - Default: False.+- `-p` _number_ Percentages padding+    - Width, in number of digits, for quantities representing+      percentages. For instance `-p 3` means that all percentages+      in the monitor will be represented using 3 digits.+    - Long option: `--ppad`+    - Default value: 0 (don't pad)+- `-d` _number_ Decimal digits+    - Number of digits after the decimal period to use in float values.+    - Long option: `--ddigits`+    - Default value: 0 (display only integer part)+- `-m` _number_ Minimum field width+    - Minimum width, in number of characters, of the fields in the+      monitor template. Values whose printed representation is shorter+      than this value will be padded using the padding characters+      given by the `-c` option with the alignment specified by `-a`+      (see below).+    - Long option: `--minwidth`+    - Default: 0+- `-M` _number_ Maximum field width+    - Maximum width, in number of characters, of the fields in the+      monitor template. Values whose printed representation is longer+      than this value will be truncated.+    - Long option: `--maxwidth`+    - Default: 0 (no maximum width)+- `-w` _number_ Fixed field width+    - All fields will be set to this width, padding or truncating as+      needed.+    - Long option: `--width`+    - Default: 0 (variable width)+- `-c` _string_+    - Characters used for padding. The characters of _string_ are used+      cyclically. E.g., with `-P +- -w 6`, a field with value "foo"+      will be represented as "+-+foo".+    - Long option: `--padchars`+    - Default value: " "+- `-a` r|l Field alignment+    - Whether to use right (r) or left (l) alignment of field values+      when padding.+    - Long option: `--align`+    - Default value: r (padding to the left)+- `-b` _string_ Bar background+    - Characters used, cyclically, to draw the background of bars.+      For instance, if you set this option to "·.", an empty bar will+      look like this: `·.·.·.·.·.`+    - Long option: `--bback`+    - Default value: ":"+- `-f` _string_ Bar foreground+    - Characters used, cyclically, to draw the foreground of bars.+    - Long option: `--bfore`+    - Default value: "#"+- `-W` _number_ Bar width+    - Total number of characters used to draw bars.+    - Long option: `--bwidth`+    - Default value: 10++Commands' arguments must be set as a list. E.g.:++    Run Weather "EGPF" ["-t", "<station>: <tempC>C"] 36000++In this case xmobar will run the weather monitor, getting information+for the weather station ID EGPF (Glasgow Airport, as a homage to GHC)+every hour (36000 tenth of seconds), with a template that will output+something like:++    Glasgow Airport: 16.0C++## Executing External Commands++In order to execute an external command you can either write the+command name in the template, in this case it will be executed without+arguments, or you can configure it in the "commands" configuration+option list with the Com template command:++`Com ProgramName Args Alias RefreshRate`++- ProgramName: the name of the program+- Args: the arguments to be passed to the program at execution time+- RefreshRate: number of tenths of second between re-runs of the+  command. A zero or negative rate means that the command will be+  executed only once.+- Alias: a name to be used in the template. If the alias is en empty+  string the program name can be used in the template.++E.g.:++        Run Com "uname" ["-s","-r"] "" 0++can be used in the output template as `%uname%` (and xmobar will call+_uname_ only once), while++        Run Com "date" ["+\"%a %b %_d %H:%M\""] "mydate" 600++can be used in the output template as `%mydate%`++## Other Plugins++`StdinReader`++- Aliases to StdinReader+- Displays any text received by xmobar on its standard input.++`Date Format Alias RefreshRate`++- Format is a time format string, as accepted by the standard ISO C+  `strftime` function (or Haskell's `formatCalendarTime`).+- Sample usage: `Run Date "%a %b %_d %Y <fc=#ee9a00>%H:%M:%S</fc>" "date" 10`++`DateZone Format Locale Zone Alias RefreshRate`++- Format is a time format string, as accepted by the standard ISO C+  `strftime` function (or Haskell's `formatCalendarTime`).+- If Locale is "" the default locale of the system is used, otherwise the given+  locale. If there are more instances of DateZone, using "" as input for Locale+  is not recommended.+- Zone is the name of the TimeZone. It is assumed that the tz database is stored+  in /usr/share/zoneinfo/. If "" is given as Zone, the default system time is+  used.+- Sample usage:+  `Run DateZone "%a %H:%M:%S" "de_DE.UTF-8" "Europe/Vienna" "viennaTime" 10`++`CommandReader "/path/to/program" Alias`++- Runs the given program, and displays its standard output.++`PipeReader "/path/to/pipe" Alias`++- Reads its displayed output from the given pipe.++`XMonadLog`++- Aliases to XMonadLog+- Displays information from xmonad's `_XMONAD_LOG`. You can set this+  property by using `xmonadPropLog` as your log hook in xmonad's+  configuration, as in the following example (more info [here]):++        main = do+          spawn "xmobar"+          xmonad $ defaultConfig {+            logHook = dynamicLogString defaultPP >>= xmonadPropLog+          }+   This plugin can be used as a sometimes more convenient alternative+   to `StdinReader`. For instance, it allows you to (re)start xmobar+   outside xmonad.++[here]: http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-DynamicLog.html++Plugins+=======++## Writing a Plugin++Writing a plugin for xmobar should be very simple. You need to create+a data type with at least one constructor.++Next you must declare this data type an instance of the `Exec` class, by+defining the 1 needed method (alternatively `start` or `run`) and 2+optional ones (alias and rate):++        start :: e -> (String -> IO ()) -> IO ()+        run   :: e -> IO String+        rate  :: e -> Int+        alias :: e -> String++`start` must receive a callback to be used to display the `String`+produced by the plugin. This method can be used for plugins that need+to perform asynchronous actions. See `Plugins/PipeReader.hs` for an+example.++`run` can be used for simpler plugins. If you define only `run` the+plugin will be run every second. To overwrite this default you just+need to implement `rate`, which must return the number of tenth of+seconds between every successive runs. See `Plugins/HelloWorld.hs` for+an example of a plugin that runs just once, and `Plugins/Date.hs` for+one that implements `rate`.++Notice that Date could be implemented as:++        instance Exec Date where+            alias (Date _ a _) = a+            start (Date f _ r) = date f r++        date :: String -> Int -> (String -> IO ()) -> IO ()+        date format r callback = do go+            where go = do+                    t <- toCalendarTime =<< getClockTime+                    callback $ formatCalendarTime defaultTimeLocale format t+                    tenthSeconds r >> go++This implementation is equivalent to the one you can read in+`Plugins/Date.hs`.++`alias` is the name to be used in the output template. Default alias+will be the data type constructor.++Implementing a plugin requires importing the plugin API (the `Exec`+class definition), that is exported by `Plugins.hs`. So you just need+to import it in your module with:++        import Plugins++After that your type constructor can be used as an argument for the+Runnable type constructor `Run` in the `commands` list of the+configuration options.++This requires importing your plugin into `Config.hs` and adding your+type to the type list in the type signature of `Config.runnableTypes`.++For a very basic example see `samples/Plugins/HelloWorld.hs` or the+other plugins that are distributed with xmobar.++## Installing/Removing a Plugin++Installing a plugin should require 3 steps. Here we are going to+install the HelloWorld plugin that comes with xmobar, assuming that+you copied it to `src/Plugins`:++1. import the plugin module in `Config.hs`, by adding:++        import Plugins.HelloWorld++2. add the plugin data type to the list of data types in the type+   signature of `runnableTypes` in `Config.hs`. For instance, for the+   HelloWorld plugin, change `runnableTypes` into:++        runnableTypes :: Command :*: Monitors :*: HelloWorld :*: ()+        runnableTypes = undefined++3. Rebuild and reinstall xmobar. Now test it with:++        xmobar Plugins/helloworld.config++As you may see in the example configuration file, the plugin can be+used by adding, in the `commands` list:++        Run HelloWorld++and, in the output template, the alias of the plugin:++        %helloWorld%++That's it.++To remove a plugin, just remove its type from the type signature of+runnableTypes and remove the imported modules.++To remove the system monitor plugin:++1. remove, from `Config.hs`, the line++        import Plugins.Monitors++2. in `Config.hs` change++         runnableTypes :: Command :*: Monitors :*: ()+         runnableTypes = undefined++    to++         runnableTypes :: Command :*: ()+         runnableTypes = undefined++3. rebuild xmobar.++Authors and credits+===================++Andrea Rossato originally designed and implemented xmobar up to+version 0.11.1. Since then, it is maintained and developed by [Jose+Antonio Ortega Ruiz](http://hacks-galore.org/jao/), with the help of+the greater Haskell community.++In particular, xmobar [incorporates patches] by Ben Boeckel, Roman+Cheplyaka, John Goerzen, Juraj Hercek, Tomas Janousek, Spencer+Janssen, Lennart Kolmodin, Krzysztof Kosciuszkiewicz, Dmitry+Kurochkin, Svein Ove, Martin Perner, Jens Petersen, Petr Rockai,+Andrew Sackville-West, Alexander Solovyov, Artem Tarasov, Sergei+Trofimovich, Thomas Tuegel, Jan Vornberger, Daniel Wagner and Norbert+Zeh.++[incorporates patches]: http://www.ohloh.net/p/xmobar/contributors++## Thanks++__Andrea Rossato__:++Thanks to Robert Manea and Spencer Janssen for their help in+understanding how X works. They gave me suggestions on how to solve+many problems with xmobar.++Thanks to Claus Reinke for make me understand existential types (or at+least for letting me think I grasp existential types...;-).++__jao__:++Thanks to Andrea for creating xmobar in the first place, and for+giving me the chance to contribute.++Useful links+============++- [Github page].+- [Mailing list].+- [xmobar's Ohloh page].++- To understand the internal mysteries of xmobar you may try reading+  [this tutorial] on X Window Programming in Haskell.++- My [sawflibs] project includes a module to automate running xmobar+  in [sawfish].++[xmobar's Ohloh page]: https://www.ohloh.net/p/xmobar+[this tutorial]: http://www.haskell.org/haskellwiki/X_window_programming_in_Haskell+[sawflibs]: http://github.com/jaor/sawflibs++License+=======++This software is released under a BSD-style license. See [LICENSE] for+more details.++Copyright &copy; 2007-2010 Andrea Rossato++Copyright &copy; 2010-2012 Jose Antonio Ortega Ruiz++[Github]: http://github.com/jaor/xmobar/+[Github page]: http://github.com/jaor/xmobar+[Hackage]: http://hackage.haskell.org/package/xmobar/+[LICENSE]: https://github.com/jaor/xmobar/raw/master/LICENSE+[Mailing list]: http://projects.haskell.org/cgi-bin/mailman/listinfo/xmobar+[MPD]: http://mpd.wikia.com/+[X11-xft]: http://hackage.haskell.org/package/X11-xft/+[i3status]: http://i3wm.org/i3status/+[i3status manual]: http://i3wm.org/i3status/manpage.html#_using_i3status_with_xmobar+[iwlib]: http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html+[hinotify]: http://hackage.haskell.org/package/hinotify/+[libmpd]: http://hackage.haskell.org/package/libmpd/+[dbus-core]: http://hackage.haskell.org/package/dbus-core+[text]: http://hackage.haskell.org/package/text+[sawfish]: http://sawfish.wikia.com/+[utf8-string]: http://hackage.haskell.org/package/utf8-string/+[alsa-core]: http://hackage.haskell.org/package/alsa-core+[alsa-mixer]: http://hackage.haskell.org/package/alsa-mixer+[timezone-olson]: http://hackage.haskell.org/package/timezone-olson+[timezone-series]: http://hackage.haskell.org/package/timezone-series
samples/xmobar.config view
@@ -1,4 +1,6 @@ Config { font = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"+       , borderColor = "black"+       , border = TopB        , bgColor = "black"        , fgColor = "grey"        , position = Top
src/Main.hs view
@@ -92,32 +92,34 @@  data Opts = Help           | Version-          | Font     String-          | BgColor  String-          | FgColor  String+          | Font       String+          | BgColor    String+          | FgColor    String           | T           | B-          | AlignSep String-          | Commands String-          | SepChar  String-          | Template String-          | OnScr    String+          | AlignSep   String+          | Commands   String+          | AddCommand String+          | SepChar    String+          | Template   String+          | OnScr      String        deriving Show  options :: [OptDescr Opts] options =-    [ Option ['h','?' ] ["help"     ] (NoArg  Help                ) "This help"-    , Option ['V'     ] ["version"  ] (NoArg  Version             ) "Show version information"-    , Option ['f'     ] ["font"     ] (ReqArg Font     "font name") "The font name"-    , Option ['B'     ] ["bgcolor"  ] (ReqArg BgColor  "bg color" ) "The background color. Default black"-    , Option ['F'     ] ["fgcolor"  ] (ReqArg FgColor  "fg color" ) "The foreground color. Default grey"-    , Option ['o'     ] ["top"      ] (NoArg  T                   ) "Place xmobar at the top of the screen"-    , Option ['b'     ] ["bottom"   ] (NoArg  B                   ) "Place xmobar at the bottom of the screen"-    , Option ['a'     ] ["alignsep" ] (ReqArg AlignSep "alignsep" ) "Separators for left, center and right text\nalignment. Default: '}{'"-    , Option ['s'     ] ["sepchar"  ] (ReqArg SepChar  "char"     ) "The character used to separate commands in\nthe output template. Default '%'"-    , Option ['t'     ] ["template" ] (ReqArg Template "template" ) "The output template"-    , Option ['c'     ] ["commands" ] (ReqArg Commands "commands" ) "The list of commands to be executed"-    , Option ['x'     ] ["screen"   ] (ReqArg OnScr    "screen"   ) "On which X screen number to start"+    [ Option ['h','?' ] ["help"        ] (NoArg  Help                  ) "This help"+    , Option ['V'     ] ["version"     ] (NoArg  Version               ) "Show version information"+    , Option ['f'     ] ["font"        ] (ReqArg Font       "font name") "The font name"+    , Option ['B'     ] ["bgcolor"     ] (ReqArg BgColor    "bg color" ) "The background color. Default black"+    , Option ['F'     ] ["fgcolor"     ] (ReqArg FgColor    "fg color" ) "The foreground color. Default grey"+    , Option ['o'     ] ["top"         ] (NoArg  T                     ) "Place xmobar at the top of the screen"+    , Option ['b'     ] ["bottom"      ] (NoArg  B                     ) "Place xmobar at the bottom of the screen"+    , Option ['a'     ] ["alignsep"    ] (ReqArg AlignSep   "alignsep" ) "Separators for left, center and right text\nalignment. Default: '}{'"+    , Option ['s'     ] ["sepchar"     ] (ReqArg SepChar    "char"     ) "The character used to separate commands in\nthe output template. Default '%'"+    , Option ['t'     ] ["template"    ] (ReqArg Template   "template" ) "The output template"+    , Option ['c'     ] ["commands"    ] (ReqArg Commands   "commands" ) "The list of commands to be executed"+    , Option ['C'     ] ["add-command" ] (ReqArg AddCommand "command"  ) "Add to the list of commands to be executed"+    , Option ['x'     ] ["screen"      ] (ReqArg OnScr      "screen"   ) "On which X screen number to start"     ]  getOpts :: [String] -> IO ([Opts], [String])@@ -150,23 +152,26 @@ doOpts conf []     = return conf doOpts conf (o:oo) =     case o of-      Help       -> putStr   usage >> exitWith ExitSuccess-      Version    -> putStrLn info  >> exitWith ExitSuccess-      Font     s -> doOpts (conf {font     = s     }) oo-      BgColor  s -> doOpts (conf {bgColor  = s     }) oo-      FgColor  s -> doOpts (conf {fgColor  = s     }) oo-      T          -> doOpts (conf {position = Top   }) oo-      B          -> doOpts (conf {position = Bottom}) oo-      AlignSep s -> doOpts (conf {alignSep = s     }) oo-      SepChar  s -> doOpts (conf {sepChar  = s     }) oo-      Template s -> doOpts (conf {template = s     }) oo-      OnScr    n -> doOpts (conf {position = OnScreen (read n) $ position conf}) oo-      Commands s -> case readCom s of-                      Right x -> doOpts (conf { commands = x }) oo-                      Left e  -> putStr (e ++ usage) >> exitWith (ExitFailure 1)-    where readCom str =+      Help         -> putStr   usage >> exitWith ExitSuccess+      Version      -> putStrLn info  >> exitWith ExitSuccess+      Font     s   -> doOpts (conf {font     = s     }) oo+      BgColor  s   -> doOpts (conf {bgColor  = s     }) oo+      FgColor  s   -> doOpts (conf {fgColor  = s     }) oo+      T            -> doOpts (conf {position = Top   }) oo+      B            -> doOpts (conf {position = Bottom}) oo+      AlignSep s   -> doOpts (conf {alignSep = s     }) oo+      SepChar  s   -> doOpts (conf {sepChar  = s     }) oo+      Template s   -> doOpts (conf {template = s     }) oo+      OnScr    n   -> doOpts (conf {position = OnScreen (read n) $ position conf}) oo+      Commands s   -> case readCom 'c' s of+                        Right x -> doOpts (conf { commands = x }) oo+                        Left e  -> putStr (e ++ usage) >> exitWith (ExitFailure 1)+      AddCommand s -> case readCom 'C' s of+                        Right x -> doOpts (conf { commands = commands conf ++ x }) oo+                        Left e  -> putStr (e ++ usage) >> exitWith (ExitFailure 1)+    where readCom c str =               case readStr str of-	        [x] -> Right x-	        _   -> Left "xmobar: cannot read list of commands specified with the -c option\n"+                [x] -> Right x+                _   -> Left ("xmobar: cannot read list of commands specified with the -" ++ c:" option\n")           readStr str =               [x | (x,t) <- reads str, ("","") <- lex t]
src/Plugins/Date.hs view
@@ -21,7 +21,7 @@ import Plugins  import System.Locale-import System.Time+import Data.Time  data Date = Date String String Int     deriving (Read, Show)@@ -32,6 +32,4 @@     rate  (Date _ _ r) = r  date :: String -> IO String-date format = do-  t <- toCalendarTime =<< getClockTime-  return $ formatCalendarTime defaultTimeLocale format t+date format = getZonedTime >>= return . formatTime defaultTimeLocale format
src/Plugins/DateZone.hs view
@@ -34,7 +34,6 @@  import System.IO.Unsafe import System.Locale (TimeLocale)-import System.Time   @@ -62,11 +61,9 @@       where go func = func >>= cb >> tenthSeconds r >> go func  date :: String -> TimeLocale -> IO String-date format loc = do-  t <- toCalendarTime =<< getClockTime-  return $ formatCalendarTime loc format t+date format loc = getZonedTime >>= return . formatTime loc format  dateZone :: String -> TimeLocale -> TimeZoneSeries -> IO String-dateZone format loc timeZone = do-  zonedTime <- getZonedTime-  return $ formatTime loc format $ utcToLocalTime' timeZone $ zonedTimeToUTC zonedTime+dateZone format loc timeZone = getZonedTime >>= return . formatTime loc format . utcToLocalTime' timeZone . zonedTimeToUTC+--   zonedTime <- getZonedTime+--   return $ formatTime loc format $ utcToLocalTime' timeZone $ zonedTimeToUTC zonedTime
src/Plugins/Kbd.hsc view
@@ -18,7 +18,7 @@ import Graphics.X11.Xlib import Graphics.X11.Xlib.Extras import Foreign-import Foreign.C.Types (CUInt,CULong,CInt,CUShort,CChar,CUChar)+import Foreign.C.Types import Foreign.C.String import Plugins import Control.Monad (forever)@@ -30,7 +30,7 @@ #include <X11/extensions/XKB.h> #include <X11/extensions/XKBstr.h> --- +-- -- Definition for XkbStaceRec and getKbdLayout taken from -- XMonad.Layout.XKBLayout --@@ -110,7 +110,7 @@ data XkbKeyAliasRec = XkbKeyAliasRec { 	real  :: Ptr CChar, -- array 	t_alias :: Ptr CChar  -- array-} +}  -- -- the t_ before geometry is just because of name collisions@@ -182,14 +182,14 @@         r_geometry <- (#peek XkbNamesRec, geometry) ptr         r_symbols <- (#peek XkbNamesRec, symbols ) ptr         r_types <- (#peek XkbNamesRec, types ) ptr-        r_compat <- (#peek XkbNamesRec, compat ) ptr  +        r_compat <- (#peek XkbNamesRec, compat ) ptr         r_vmods <- (#peek XkbNamesRec,  vmods ) ptr-        r_indicators <- (#peek XkbNamesRec, indicators ) ptr  -        r_groups <- (#peek XkbNamesRec, groups ) ptr -        r_keys <- (#peek XkbNamesRec, keys ) ptr   +        r_indicators <- (#peek XkbNamesRec, indicators ) ptr+        r_groups <- (#peek XkbNamesRec, groups ) ptr+        r_keys <- (#peek XkbNamesRec, keys ) ptr         r_key_aliases <- (#peek XkbNamesRec, key_aliases  ) ptr-        r_radio_groups <- (#peek XkbNamesRec, radio_groups  ) ptr -        r_phys_symbols <- (#peek XkbNamesRec, phys_symbols ) ptr  +        r_radio_groups <- (#peek XkbNamesRec, radio_groups  ) ptr+        r_phys_symbols <- (#peek XkbNamesRec, phys_symbols ) ptr         r_num_keys <- (#peek XkbNamesRec,num_keys  ) ptr         r_num_key_aliases <- (#peek XkbNamesRec, num_key_aliases  ) ptr         r_num_rg <- (#peek XkbNamesRec, num_rg ) ptr@@ -330,7 +330,7 @@  -- splits the layout string into the actual layouts splitLayout :: String -> [String]-splitLayout s = splitLayout' noLaySymbols $ split s '+' +splitLayout s = splitLayout' noLaySymbols $ split s '+'  splitLayout' :: [String] ->  [String] -> [String] --                  end of recursion, remove empty strings@@ -349,7 +349,7 @@  -- replaces input string if on search list (exact match) with corresponding -- element on replacement list.--- +-- -- if not found, return string unchanged searchReplaceLayout :: KbdOpts -> String -> String searchReplaceLayout opts s = let c = findIndex (\x -> fst x == s) opts in@@ -394,4 +394,3 @@         return ()  -- vim:ft=haskell:ts=4:shiftwidth=4:softtabstop=4:expandtab:foldlevel=20:-
src/Plugins/Mail.hs view
@@ -56,9 +56,6 @@                                     | (m, n) <- zip ts ns                                     , n /= 0 ] -modifyTVar :: TVar a -> (a -> a) -> STM ()-modifyTVar v f = readTVar v >>= writeTVar v . f- handle :: TVar (Set String) -> Event -> IO () handle v e = atomically $ modifyTVar v $ case e of     Created  {} -> create
src/Plugins/Monitors.hs view
@@ -44,6 +44,9 @@ #ifdef ALSA import Plugins.Monitors.Volume #endif+#ifdef MPRIS+import Plugins.Monitors.Mpris+#endif  data Monitors = Weather      Station    Args Rate               | Network      Interface  Args Rate@@ -72,6 +75,10 @@ #ifdef ALSA               | Volume   String     String Args Rate #endif+#ifdef MPRIS+              | Mpris1   String     Args Rate+              | Mpris2   String     Args Rate+#endif                 deriving (Show,Read,Eq)  type Args      = [String]@@ -112,6 +119,10 @@ #ifdef ALSA     alias (Volume m c _ _) = m ++ ":" ++ c #endif+#ifdef MPRIS+    alias (Mpris1 _ _ _) = "mpris1"+    alias (Mpris2 _ _ _) = "mpris2"+#endif     start (Network  i a r) = startNet i a r     start (Cpu a r) = startCpu a r     start (MultiCpu a r) = startMultiCpu a r@@ -139,4 +150,8 @@ #endif #ifdef ALSA     start (Volume m c a r) = runM a volumeConfig (runVolume m c) r+#endif+#ifdef MPRIS+    start (Mpris1 s a r) = runM a mprisConfig (runMPRIS1 s) r+    start (Mpris2 s a r) = runM a mprisConfig (runMPRIS2 s) r #endif
src/Plugins/Monitors/Batt.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module      :  Plugins.Monitors.Batt--- Copyright   :  (c) 2010, 2011 Jose A Ortega+-- Copyright   :  (c) 2010, 2011, 2012 Jose A Ortega --                (c) 2010 Andrea Rossato, Petr Rockai -- License     :  BSD-style (see LICENSE) --@@ -13,8 +13,6 @@ -- ----------------------------------------------------------------------------- -{-# LANGUAGE BangPatterns #-}- module Plugins.Monitors.Batt ( battConfig, runBatt, runBatt' ) where  import Control.Exception (SomeException, handle)@@ -34,7 +32,7 @@   , lowThreshold :: Float   , highThreshold :: Float   , onlineFile :: FilePath-  , chargeFile :: FilePath+  , scale :: Float   }  defaultOpts :: BattOpts@@ -48,7 +46,7 @@   , lowThreshold = -12   , highThreshold = -10   , onlineFile = "AC/online"-  , chargeFile = "charge_full"+  , scale = 1e6   }  options :: [OptDescr (BattOpts -> BattOpts)]@@ -62,7 +60,7 @@   , Option "L" ["lowt"] (ReqArg (\x o -> o { lowThreshold = read x }) "") ""   , Option "H" ["hight"] (ReqArg (\x o -> o { highThreshold = read x }) "") ""   , Option "f" ["online"] (ReqArg (\x o -> o { onlineFile = x }) "") ""-  , Option "c" ["charge"] (ReqArg (\x o -> o { chargeFile = x }) "") ""+  , Option "s" ["scale"] (ReqArg (\x o -> o {scale = read x}) "") ""   ]  parseOpts :: [String] -> IO BattOpts@@ -91,57 +89,57 @@ data Battery = Battery   { full :: !Float   , now :: !Float-  , voltage :: !Float-  , current :: !Float+  , power :: !Float   } -safeFileExist :: String -> IO Bool-safeFileExist f = handle noErrors $ fileExist f+safeFileExist :: String -> String -> IO Bool+safeFileExist d f = handle noErrors $ fileExist (d </> f)   where noErrors = const (return False) :: SomeException -> IO Bool -batteryFiles :: String -> String -> IO Files-batteryFiles charge_file bat =-  do is_charge <- safeFileExist $ prefix </> "charge_now"-     is_energy <- safeFileExist $ prefix </> "energy_now"-     is_current <- safeFileExist $ prefix </> "current_now"+batteryFiles :: String -> IO Files+batteryFiles bat =+  do is_charge <- exists "charge_now"+     is_energy <- if is_charge then return False else exists "energy_now"+     is_current <- exists "current_now"+     plain <- if is_charge then exists "charge_full" else exists "energy_full"      let cf = if is_current then "current_now" else "power_now"+         sf = if plain then "" else "_design"      return $ case (is_charge, is_energy) of-       (True, _) -> files "charge" cf-       (_, True) -> files "energy" cf+       (True, _) -> files "charge" cf sf+       (_, True) -> files "energy" cf sf        _ -> NoFiles   where prefix = sysDir </> bat-        files ch cf = Files { fFull = prefix </> charge_file-                            , fNow = prefix </> ch ++ "_now"-                            , fCurrent = prefix </> cf-                            , fVoltage = prefix </> "voltage_now" }+        exists = safeFileExist prefix+        files ch cf sf = Files { fFull = prefix </> ch ++ "_full" ++ sf+                               , fNow = prefix </> ch ++ "_now"+                               , fCurrent = prefix </> cf+                               , fVoltage = prefix </> "voltage_now" }  haveAc :: FilePath -> IO Bool haveAc f =   handle onError $ withFile (sysDir </> f) ReadMode (fmap (== "1") . hGetLine)   where onError = const (return False) :: SomeException -> IO Bool -readBattery :: Files -> IO Battery-readBattery NoFiles = return $ Battery 0 0 0 0-readBattery files =-    do a <- grab $ fFull files -- microwatthours+readBattery :: Float -> Files -> IO Battery+readBattery _ NoFiles = return $ Battery 0 0 0+readBattery sc files =+    do a <- grab $ fFull files        b <- grab $ fNow files-       c <- grab $ fVoltage files -- microvolts-       d <- grab $ fCurrent files -- microwatts (huh!)-       return $ Battery (3600 * a / 1000000) -- wattseconds-                        (3600 * b / 1000000) -- wattseconds-                        (c / 1000000) -- volts-                        (if c > 0 then (d / c) else -1) -- amperes+       d <- grab $ fCurrent files+       return $ Battery (3600 * a / sc) -- wattseconds+                        (3600 * b / sc) -- wattseconds+                        (d / sc) -- watts     where grab f = handle onError $ withFile f ReadMode (fmap read . hGetLine)           onError = const (return (-1)) :: SomeException -> IO Float  readBatteries :: BattOpts -> [Files] -> IO Result readBatteries opts bfs =-    do bats <- mapM readBattery (take 3 bfs)+    do bats <- mapM (readBattery (scale opts)) (take 3 bfs)        ac <- haveAc (onlineFile opts)        let sign = if ac then 1 else -1            ft = sum (map full bats)            left = if ft > 0 then sum (map now bats) / ft else 0-           watts = sign * sum (map voltage bats) * sum (map current bats)+           watts = sign * sum (map power bats)            time = if watts == 0 then 0 else sum $ map time' bats            mwatts = if watts == 0 then 1 else sign * watts            time' b = (if ac then full b - now b else now b) / mwatts@@ -154,26 +152,28 @@ runBatt' :: [String] -> [String] -> Monitor String runBatt' bfs args = do   opts <- io $ parseOpts args-  c <- io $ readBatteries opts =<< mapM (batteryFiles (chargeFile opts)) bfs+  c <- io $ readBatteries opts =<< mapM batteryFiles bfs+  suffix <- getConfigValue useSuffix+  d <- getConfigValue decDigits   case c of     Result x w t s ->       do l <- fmtPercent x-         parseTemplate (l ++ s:[fmtTime $ floor t, fmtWatts w opts])+         parseTemplate (l ++ s:[fmtTime $ floor t, fmtWatts w opts suffix d])     NA -> return "N/A"   where fmtPercent :: Float -> Monitor [String]         fmtPercent x = do           p <- showPercentWithColors x           b <- showPercentBar (100 * x) x           return [b, p]-        fmtWatts x o = color x o $ showDigits 1 x ++ "W"+        fmtWatts x o s d = color x o $ showDigits d x ++ (if s then "W" else "")         fmtTime :: Integer -> String         fmtTime x = hours ++ ":" ++ if length minutes == 2                                     then minutes else '0' : minutes           where hours = show (x `div` 3600)                 minutes = show ((x `mod` 3600) `div` 60)-        maybeColor Nothing _ = ""+        maybeColor Nothing str = str         maybeColor (Just c) str = "<fc=" ++ c ++ ">" ++ str ++ "</fc>"         color x o | x >= 0 = maybeColor (posColor o)-                  | x >= highThreshold o = maybeColor (highWColor o)-                  | x >= lowThreshold o = maybeColor (mediumWColor o)+                  | -x >= highThreshold o = maybeColor (highWColor o)+                  | -x >= lowThreshold o = maybeColor (mediumWColor o)                   | otherwise = maybeColor (lowWColor o)
src/Plugins/Monitors/Common.hs view
@@ -78,6 +78,7 @@        , template    :: IORef String        , export      :: IORef [String]        , ppad        :: IORef Int+       , decDigits   :: IORef Int        , minWidth    :: IORef Int        , maxWidth    :: IORef Int        , padChars    :: IORef String@@ -120,6 +121,7 @@        t  <- newIORef tmpl        e  <- newIORef exprts        p  <- newIORef 0+       d  <- newIORef 0        mn <- newIORef 0        mx <- newIORef 0        pc <- newIORef " "@@ -128,7 +130,7 @@        bf <- newIORef "#"        bw <- newIORef 10        up <- newIORef False-       return $ MC nc l lc h hc t e p mn mx pc pr bb bf bw up+       return $ MC nc l lc h hc t e p d mn mx pc pr bb bf bw up  data Opts = HighColor String           | NormalColor String@@ -137,6 +139,7 @@           | High String           | Template String           | PercentPad String+          | DecDigits String           | MinWidth String           | MaxWidth String           | Width String@@ -149,27 +152,27 @@  options :: [OptDescr Opts] options =-    [ Option "H"  ["High"]     (ReqArg High "number"               )  "The high threshold"-    , Option "L"  ["Low"]      (ReqArg Low "number"                )  "The low threshold"-    , Option "h"  ["high"]     (ReqArg HighColor "color number"    )  "Color for the high threshold: ex \"#FF0000\""-    , Option "n"  ["normal"]   (ReqArg NormalColor "color number"  )  "Color for the normal threshold: ex \"#00FF00\""-    , Option "l"  ["low"]      (ReqArg LowColor "color number"     )  "Color for the low threshold: ex \"#0000FF\""-    , Option "t"  ["template"] (ReqArg Template "output template"  )  "Output template."-    , Option "S"  ["suffix"]   (ReqArg UseSuffix "True/False"      )  "Use % to display percents or other suffixes."-    , Option "p"  ["ppad"]     (ReqArg PercentPad "percent padding")  "Minimum percentage width."-    , Option "m"  ["minwidth"] (ReqArg MinWidth "minimum width"    )  "Minimum field width"-    , Option "M"  ["maxwidth"] (ReqArg MaxWidth "maximum width"    )  "Maximum field width"-    , Option "w"  ["width"]    (ReqArg Width "fixed width"         )  "Fixed field width"-    , Option "c"  ["padchars"] (ReqArg PadChars "padding chars"    )  "Characters to use for padding"-    , Option "a"  ["align"]    (ReqArg PadAlign "padding alignment")  "'l' for left padding, 'r' for right"-    , Option "b"  ["bback"]    (ReqArg BarBack "bar background"    )  "Characters used to draw bar backgrounds"-    , Option "f"  ["bfore"]    (ReqArg BarFore "bar foreground"    )  "Characters used to draw bar foregrounds"-    , Option "W"  ["bwidth"]   (ReqArg BarWidth "bar width"        )  "Bar width"+    [+      Option "H"  ["High"] (ReqArg High "number") "The high threshold"+    , Option "L"  ["Low"] (ReqArg Low "number") "The low threshold"+    , Option "h"  ["high"] (ReqArg HighColor "color number") "Color for the high threshold: ex \"#FF0000\""+    , Option "n"  ["normal"] (ReqArg NormalColor "color number") "Color for the normal threshold: ex \"#00FF00\""+    , Option "l"  ["low"] (ReqArg LowColor "color number") "Color for the low threshold: ex \"#0000FF\""+    , Option "t"  ["template"] (ReqArg Template "output template") "Output template."+    , Option "S"  ["suffix"] (ReqArg UseSuffix "True/False") "Use % to display percents or other suffixes."+    , Option "d"  ["ddigits"] (ReqArg DecDigits "decimal digits") "Number of decimal digits to display."+    , Option "p"  ["ppad"] (ReqArg PercentPad "percent padding") "Minimum percentage width."+    , Option "m"  ["minwidth"] (ReqArg MinWidth "minimum width") "Minimum field width"+    , Option "M"  ["maxwidth"] (ReqArg MaxWidth "maximum width") "Maximum field width"+    , Option "w"  ["width"] (ReqArg Width "fixed width") "Fixed field width"+    , Option "c"  ["padchars"] (ReqArg PadChars "padding chars") "Characters to use for padding"+    , Option "a"  ["align"] (ReqArg PadAlign "padding alignment") "'l' for left padding, 'r' for right"+    , Option "b"  ["bback"] (ReqArg BarBack "bar background") "Characters used to draw bar backgrounds"+    , Option "f"  ["bfore"] (ReqArg BarFore "bar foreground") "Characters used to draw bar foregrounds"+    , Option "W"  ["bwidth"] (ReqArg BarWidth "bar width") "Bar width"     ] -doArgs :: [String]-       -> ([String] -> Monitor String)-       -> Monitor String+doArgs :: [String] -> ([String] -> Monitor String) -> Monitor String doArgs args action =     case getOpt Permute options args of       (o, n, [])   -> do doConfigOptions o@@ -190,6 +193,7 @@           LowColor    c -> setConfigValue (Just c) lowColor           Template    t -> setConfigValue t template           PercentPad  p -> setConfigValue (nz p) ppad+          DecDigits   d -> setConfigValue (nz d) decDigits           MinWidth    w -> setConfigValue (nz w) minWidth           MaxWidth    w -> setConfigValue (nz w) maxWidth           Width       w -> setConfigValue (nz w) minWidth >>
src/Plugins/Monitors/CoreCommon.hs view
@@ -25,19 +25,10 @@ import Plugins.Monitors.Common import System.Directory -#ifdef GHC6-import Control.Monad.Reader--instance (Monad f, Applicative f) => Applicative (ReaderT r f) where-    pure a = ReaderT $ const (pure a)-    f <*> a = ReaderT $ \r -> -              ((runReaderT f r) <*> (runReaderT a r))-#endif- checkedDataRetrieval :: (Ord a, Num a)                      => String -> [String] -> Maybe (String, String -> Int)                      -> (Double -> a) -> (a -> String) -> Monitor String-checkedDataRetrieval msg path lbl trans fmt = liftM (maybe msg id) $+checkedDataRetrieval msg path lbl trans fmt = liftM (fromMaybe msg) $                                               retrieveData path lbl trans fmt  retrieveData :: (Ord a, Num a)@@ -64,9 +55,9 @@  -- | Function to turn a list of of strings into a list of path components pathComponents :: [String] -> [Comp]-pathComponents = joinComps . drop 2 . concat . intersperse [Space] . map splitParts+pathComponents = joinComps . drop 2 . intercalate [Space] . map splitParts   where-    splitParts p | (l, _:r) <- break (== '/') p = (Comp l):Slash:splitParts r+    splitParts p | (l, _:r) <- break (== '/') p = Comp l : Slash : splitParts r                  | otherwise                    = [Comp p]      joinComps = uncurry joinComps' . partition isComp@@ -101,24 +92,24 @@                        )   where     addLabel (i, f) = maybe (return $ Just (f, Left i))-                            (\(s, t) -> justIfExists f s t)+                            (uncurry (justIfExists f))                             lbl      justIfExists f s t = let f' = take (length f - length s) f ++ s-                         in  ifthen (Just (f, Right (f', t))) Nothing <$> (io $ doesFileExist f')+                         in  ifthen (Just (f, Right (f', t))) Nothing <$> io (doesFileExist f')      recFindFiles [] d  =  ifthen [d] []-                      <$> (io $ if null d then return False else doesFileExist d)+                      <$> io (if null d then return False else doesFileExist d)     recFindFiles ps d  =  ifthen (recFindFiles' ps d) (return [])-                      =<< (io $ if null d then return True else doesDirectoryExist d)+                      =<< io (if null d then return True else doesDirectoryExist d)      recFindFiles' []         _  =  error "Should not happen"     recFindFiles' (Fix p:ps) d  =  recFindFiles ps (d ++ "/" ++ p)     recFindFiles' (Var p:ps) d  =  concat-                               <$> (     mapM (recFindFiles ps)-                                      .  map (\f -> d ++ "/" ++ f)-                                      .  filter (matchesVar p)-                                     =<< (io $ getDirectoryContents d)+                               <$> ((mapM (recFindFiles ps+                                           . (\f -> d ++ "/" ++ f))+                                      . filter (matchesVar p))+                                     =<< io (getDirectoryContents d)                                    )      matchesVar []     _  = False@@ -135,8 +126,8 @@ readFiles :: (String, Either Int (String, String -> Int))           -> Monitor (Int, String) readFiles (fval, flbl) = (,) <$> either return (\(f, ex) -> liftM ex-                                                          $ io $ readFile f) flbl-                             <*> (io $ readFile fval)+                                                            $ io $ readFile f) flbl+                             <*> io (readFile fval)  -- | Function that captures if-then-else ifthen :: a -> a -> Bool -> a
src/Plugins/Monitors/CoreTemp.hs view
@@ -17,6 +17,9 @@ import Plugins.Monitors.Common import Plugins.Monitors.CoreCommon ++import Data.Char (isDigit)+ -- | -- Core temperature default configuration. Default template contains only one -- core temperature, user should specify custom template in order to get more@@ -31,9 +34,10 @@ -- Function retrieves monitor string holding the core temperature -- (or temperatures) runCoreTemp :: [String] -> Monitor String-runCoreTemp _ = let path = ["/sys/bus/platform/devices/coretemp.", "/temp", "_input"]-                    lbl  = Just ("_label", read . drop 5)+runCoreTemp _ = let path = ["/sys/bus/platform/devices/coretemp.",+                            "/temp",+                            "_input"]+                    lbl  = Just ("_label", read . (dropWhile (not . isDigit)))                     divisor = 1e3 :: Double                     failureMessage = "CoreTemp: N/A"                 in  checkedDataRetrieval failureMessage path lbl (/divisor) show-
src/Plugins/Monitors/Disk.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module      :  Plugins.Monitors.Disk--- Copyright   :  (c) 2010, 2011 Jose A Ortega Ruiz+-- Copyright   :  (c) 2010, 2011, 2012 Jose A Ortega Ruiz -- License     :  BSD-style (see LICENSE) -- -- Maintainer  :  Jose A Ortega Ruiz <jao@gnu.org>@@ -19,9 +19,11 @@  import Data.IORef (IORef, newIORef, readIORef, writeIORef) +import Control.Exception (SomeException, handle) import Control.Monad (zipWithM) import qualified Data.ByteString.Lazy.Char8 as B-import Data.List (isPrefixOf, find, intercalate)+import Data.List (isPrefixOf, find)+import System.Directory (canonicalizePath)  diskIOConfig :: IO MConfig diskIOConfig = mkMConfig "" ["total", "read", "write",@@ -38,13 +40,15 @@ mountedDevices :: [String] -> IO [(DevName, Path)] mountedDevices req = do   s <- B.readFile "/etc/mtab"-  return (parse s)+  parse `fmap` mapM canon (devs s)   where-    parse = map undev . filter isDev . map (firstTwo . B.words) . B.lines+    canon (d, p) = do {d' <- canonicalizePath d; return (d', p)}+    devs =  filter isDev . map (firstTwo . B.words) . B.lines+    parse = map undev . filter isReq     firstTwo (a:b:_) = (B.unpack a, B.unpack b)     firstTwo _ = ("", "")-    isDev (d, p) = "/dev/" `isPrefixOf` d &&-                   (p `elem` req || drop 5 d `elem` req)+    isDev (d, _) = "/dev/" `isPrefixOf` d+    isReq (d, p) = p `elem` req || drop 5 d `elem` req     undev (d, f) = (drop 5 d, f)  diskData :: IO [(DevName, [Float])]@@ -77,11 +81,10 @@ fsStats path = do   stats <- getFileSystemStats path   case stats of-    Nothing -> return [-1, -1, -1]+    Nothing -> return [0, 0, 0]     Just f -> let tot = fsStatByteCount f                   free = fsStatBytesAvailable f-                  used = fsStatBytesUsed f-              in return [tot, free, used]+              in return [tot, free, tot - free]  speedToStr :: Float -> String speedToStr = showWithUnits 2 1@@ -118,7 +121,7 @@   mounted <- io $ mountedDevices (map fst disks)   dat <- io $ mountedData dref (map fst mounted)   strs <- mapM runDiskIO' $ devTemplates disks mounted dat-  return $ intercalate " " strs+  return $ unwords strs  startDiskIO :: [(String, String)] ->                [String] -> Int -> (String -> IO ()) -> IO ()@@ -131,18 +134,20 @@ runDiskU' :: String -> String -> Monitor String runDiskU' tmp path = do   setConfigValue tmp template-  fstats <- io $ fsStats path-  let strs = map sizeToStr fstats-      freep = (fstats !! 1) * 100 `div` head fstats+  [total, free, diff] <-  io (handle ign $ fsStats path)+  let strs = map sizeToStr [total, free, diff]+      freep = if total > 0 then free * 100 `div` total else 0       fr = fromIntegral freep / 100   s <- zipWithM showWithColors' strs [100, freep, 100 - freep]   sp <- showPercentsWithColors [fr, 1 - fr]   fb <- showPercentBar (fromIntegral freep) fr   ub <- showPercentBar (fromIntegral $ 100 - freep) (1 - fr)   parseTemplate $ s ++ sp ++ [fb, ub]+  where ign = const (return [0, 0, 0]) :: SomeException -> IO [Integer] + runDiskU :: [(String, String)] -> [String] -> Monitor String runDiskU disks _ = do   devs <- io $ mountedDevices (map fst disks)   strs <- mapM (\(d, p) -> runDiskU' (findTempl d p disks) p) devs-  return $ intercalate " " strs+  return $ unwords strs
src/Plugins/Monitors/MPD.hs view
@@ -102,5 +102,5 @@   where minutes = t `div` 60         seconds = t `mod` 60 -int2str :: (Num a, Ord a) => a -> String+int2str :: (Show a, Num a, Ord a) => a -> String int2str x = if x < 10 then '0':sx else sx where sx = show x
+ src/Plugins/Monitors/Mpris.hs view
@@ -0,0 +1,129 @@+{-# LANGUAGE OverloadedStrings #-}++----------------------------------------------------------------------------+-- |+-- Module      :  Plugins.Monitors.Mpris+-- Copyright   :  (c) Artem Tarasov+-- License     :  BSD-style (see LICENSE)+--+-- Maintainer  :  Artem Tarasov <lomereiter@gmail.com>+-- Stability   :  unstable+-- Portability :  unportable+--+--   MPRIS song info+--+----------------------------------------------------------------------------++module Plugins.Monitors.Mpris ( mprisConfig, runMPRIS1, runMPRIS2 ) where++-- TODO: listen to signals++import Plugins.Monitors.Common++import Text.Printf (printf)+import qualified DBus.Client.Simple as C+import DBus.Types+import DBus.Connection ( ConnectionError )+import Data.Maybe ( fromJust )+import Data.Int ( Int32, Int64 )+import System.IO.Unsafe (unsafePerformIO)+import qualified Data.Text as T++import Control.Exception (try)++class MprisVersion a where+    getProxy :: a -> C.Client -> String -> IO C.Proxy+    getMetadataReply :: a -> C.Client -> String -> IO [Variant]+    fieldsList :: a -> [String]++data MprisVersion1 = MprisVersion1+instance MprisVersion MprisVersion1 where+    getProxy MprisVersion1 c p = do+        let playerBusName = T.concat ["org.mpris.", T.pack p]+        C.proxy c (C.busName_ playerBusName) "/Player"+    getMetadataReply MprisVersion1 c p = do+        player <- getProxy MprisVersion1 c p+        C.call player "org.freedesktop.MediaPlayer" "GetMetadata" []+    fieldsList MprisVersion1 = [ "album", "artist", "arturl", "mtime", "title", "tracknumber" ]++data MprisVersion2 = MprisVersion2+instance MprisVersion MprisVersion2 where+    getProxy MprisVersion2 c p = do+        let playerBusName = T.concat ["org.mpris.MediaPlayer2.", T.pack p]+        C.proxy c (C.busName_ playerBusName) "/org/mpris/MediaPlayer2"+    getMetadataReply MprisVersion2 c p = do+        player <- getProxy MprisVersion2 c p+        C.call player "org.freedesktop.DBus.Properties"+                      "Get"+                      (map (toVariant::String -> Variant)+                           ["org.mpris.MediaPlayer2.Player", "Metadata"]+                      )+    fieldsList MprisVersion2 = [ "xesam:album", "xesam:artist", "mpris:artUrl"+                               , "mpris:length", "xesam:title", "xesam:trackNumber"+                               ]++mprisConfig :: IO MConfig+mprisConfig = mkMConfig "<artist> - <title>"+                [ "album", "artist", "arturl", "length" , "title", "tracknumber"+                ]++dbusClient :: C.Client+dbusClient = unsafePerformIO C.connectSession++runMPRIS :: (MprisVersion a) => a -> String -> [String] -> Monitor String+runMPRIS version playerName _ = do+    metadata <- io $ getMetadata version dbusClient playerName+    parseTemplate $ makeList version metadata++runMPRIS1 :: String -> [String] -> Monitor String+runMPRIS1 = runMPRIS MprisVersion1++runMPRIS2 :: String -> [String] -> Monitor String+runMPRIS2 = runMPRIS MprisVersion2++---------------------------------------------------------------------------++fromVar :: (IsVariant a) => Variant -> a+fromVar = fromJust . fromVariant++unpackMetadata :: [Variant] -> [(String, Variant)]+unpackMetadata [] = []+unpackMetadata xs = ((map (\(k, v) -> (fromVar k, fromVar v))) . unpack . head) xs where+                      unpack v = case variantType v of+                            TypeDictionary _ _ -> dictionaryItems $ fromVar v+                            TypeVariant -> unpack $ fromVar v+                            TypeStructure _ -> unpack $ head $ structureItems $ fromVar v+                            _ -> []++getMetadata :: (MprisVersion a) => a -> C.Client -> String -> IO [(String, Variant)]+getMetadata version client player = do+    reply <- try (getMetadataReply version client player) ::+                            IO (Either ConnectionError [Variant])+    return $ case reply of+                  Right metadata -> unpackMetadata metadata;+                  Left _ -> []++makeList :: (MprisVersion a) => a -> [(String, Variant)] -> [String]+makeList version md = map getStr (fieldsList version) where+            formatTime n = (if hh == 0 then printf "%02d:%02d"+                                       else printf "%d:%02d:%02d" hh) mm ss+                           where hh = (n `div` 60) `div` 60+                                 mm = (n `div` 60) `mod` 60+                                 ss = n `mod` 60+            getStr str = case lookup str md of+                Nothing -> ""+                Just v -> case variantType v of+                            TypeString -> fromVar v+                            TypeInt32 -> let num = fromVar v in+                                          case str of+                                           "mtime" -> formatTime (num `div` 1000)+                                           "tracknumber" -> printf "%02d" num+                                           "mpris:length" -> formatTime (num `div` 1000000)+                                           "xesam:trackNumber" -> printf "%02d" num+                                           _ -> (show::Int32 -> String) num+                            TypeInt64 -> let num = fromVar v in+                                          case str of+                                           "mpris:length" -> formatTime (num `div` 1000000)+                                           _ -> (show::Int64 -> String) num+                            TypeArray TypeString -> fromVar $ head $ arrayItems $ fromVar v+                            _ -> ""
src/Plugins/Monitors/Net.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module      :  Plugins.Monitors.Net--- Copyright   :  (c) 2011 Jose Antonio Ortega Ruiz+-- Copyright   :  (c) 2011, 2012 Jose Antonio Ortega Ruiz --                (c) 2007-2010 Andrea Rossato -- License     :  BSD-style (see LICENSE) --@@ -23,10 +23,8 @@ import qualified Data.ByteString.Lazy.Char8 as B  data NetDev = NA-            | ND { netDev :: String-                 , netRx :: Float-                 , netTx :: Float-                 } deriving (Eq,Show,Read)+            | NI String+            | ND String Float Float deriving (Eq,Show,Read)  type NetDevRef = IORef (NetDev, UTCTime) @@ -35,57 +33,57 @@     "<dev>: <rx>KB|<tx>KB"      -- template     ["dev", "rx", "tx", "rxbar", "txbar"]     -- available replacements --- Given a list of indexes, take the indexed elements from a list.-getNElements :: [Int] -> [a] -> [a]-getNElements ns as = map (as!!) ns+isUp :: String -> IO Bool+isUp d = do+  operstate <- B.readFile $ "/sys/class/net/" ++ d ++ "/operstate"+  return $ "up" == (B.unpack . head . B.lines) operstate --- Split into words, with word boundaries indicated by the given predicate.--- Drops delimiters.  Duplicates 'Data.List.Split.wordsBy'.------ > map (wordsBy (`elem` " :")) ["lo:31174097 31174097", "eth0:  43598 88888"]------ will become @[["lo","31174097","31174097"], ["eth0","43598","88888"]]@-wordsBy :: (a -> Bool) -> [a] -> [[a]]-wordsBy f s = case dropWhile f s of-    [] -> []-    s' -> w : wordsBy f s'' where (w, s'') = break f s'+readNetDev :: [String] -> IO NetDev+readNetDev (d:x:y:_) = do+  up <- isUp d+  return (if up then ND d (r x) (r y) else NI d)+    where r s | s == "" = 0+              | otherwise = read s / 1024 -readNetDev :: [String] -> NetDev-readNetDev [] = NA-readNetDev xs =-    ND (head xs) (r (xs !! 1)) (r (xs !! 2))-       where r s | s == "" = 0-                 | otherwise = read s / 1024+readNetDev _ = return NA -fileNet :: IO [NetDev]-fileNet = netParser `fmap` B.readFile "/proc/net/dev"+netParser :: B.ByteString -> IO [NetDev]+netParser = mapM (readNetDev . splitDevLine) . readDevLines+  where readDevLines = drop 2 . B.lines+        splitDevLine = selectCols . wordsBy (`elem` " :") . B.unpack+        selectCols cols = map (cols!!) [0,1,9]+        wordsBy f s = case dropWhile f s of+          [] -> []+          s' -> w : wordsBy f s'' where (w, s'') = break f s'  findNetDev :: String -> IO NetDev findNetDev dev = do-  nds <- fileNet-  case filter (\d -> netDev d == dev) nds of+  nds <- B.readFile "/proc/net/dev" >>= netParser+  case filter isDev nds of     x:_ -> return x     _ -> return NA--netParser :: B.ByteString -> [NetDev]-netParser =-    map (readNetDev . getNElements [0,1,9] . wordsBy (`elem` " :") . B.unpack) . drop 2 . B.lines+  where isDev (ND d _ _) = d == dev+        isDev (NI d) = d == dev+        isDev NA = False  formatNet :: Float -> Monitor (String, String) formatNet d = do     s <- getConfigValue useSuffix-    let str = if s then (++"Kb/s") . showDigits 1 else showDigits 1+    dd <- getConfigValue decDigits+    let str = if s then (++"Kb/s") . showDigits dd else showDigits dd     b <- showLogBar 0.9 d     x <- showWithColors str d     return (x, b)  printNet :: NetDev -> Monitor String printNet nd =-    case nd of-         ND d r t -> do (rx, rb) <- formatNet r-                        (tx, tb) <- formatNet t-                        parseTemplate [d,rx,tx,rb,tb]-         NA -> return "N/A"+  case nd of+    ND d r t -> do+        (rx, rb) <- formatNet r+        (tx, tb) <- formatNet t+        parseTemplate [d,rx,tx,rb,tb]+    NI _ -> return ""+    NA -> return "N/A"  parseNet :: NetDevRef -> String -> IO NetDev parseNet nref nd = do@@ -95,10 +93,11 @@   writeIORef nref (n1, t1)   let scx = realToFrac (diffUTCTime t1 t0)       scx' = if scx > 0 then scx else 1-      netRate f da db = takeDigits 2 $ (f db - f da) / scx'-      diffRate NA _ = NA-      diffRate _ NA = NA-      diffRate da db = ND nd (netRate netRx da db) (netRate netTx da db)+      rate da db = takeDigits 2 $ (db - da) / scx'+      diffRate (ND d ra ta) (ND _ rb tb) = ND d (rate ra rb) (rate ta tb)+      diffRate (NI d) _ = NI d+      diffRate _ (NI d) = NI d+      diffRate _ _ = NA   return $ diffRate n0 n1  runNet :: NetDevRef -> String -> [String] -> Monitor String
src/Plugins/Monitors/Swap.hs view
@@ -42,10 +42,11 @@        return [(tot - free) / tot, tot, tot - free, free]  formatSwap :: [Float] -> Monitor [String]-formatSwap (r:xs) =-     do other <- mapM (showWithColors (showDigits 2)) xs-        ratio <- showPercentWithColors r-        return $ ratio:other+formatSwap (r:xs) = do+  d <- getConfigValue decDigits+  other <- mapM (showWithColors (showDigits d)) xs+  ratio <- showPercentWithColors r+  return $ ratio:other formatSwap _ = return $ replicate 4 "N/A"  runSwap :: [String] -> Monitor String
src/Plugins/Monitors/Top.hs view
@@ -158,7 +158,8 @@   return (len, nts', mis')  showTimeInfo :: TimeInfo -> Monitor [String]-showTimeInfo (n, t) = showInfo n (showDigits 0 t) t+showTimeInfo (n, t) =+  getConfigValue decDigits >>= \d -> showInfo n (showDigits d t) t  showTimeInfos :: [TimeInfo] -> Monitor [[String]] showTimeInfos = mapM showTimeInfo
src/Plugins/Monitors/Volume.hs view
@@ -97,8 +97,9 @@     h <- getConfigValue highColor     m <- getConfigValue normalColor     l <- getConfigValue lowColor+    d <- getConfigValue decDigits     let db = fromIntegral dbi / 100.0-        digits = showDigits 0 db+        digits = showDigits d db         startColor | db >= highDbThresh opts = colorHelper h                    | db < lowDbThresh opts = colorHelper l                    | otherwise = colorHelper m
src/Plugins/Monitors/Wireless.hs view
@@ -27,7 +27,8 @@   let essid = wiEssid wi       qlty = fromIntegral $ wiQuality wi       e = if essid == "" then "N/A" else essid+  ep <- showWithPadding e   q <- if qlty >= 0 then showPercentWithColors (qlty/100) else showWithPadding ""   qb <- showPercentBar qlty (qlty / 100)-  parseTemplate [e, q, qb]+  parseTemplate [ep, q, qb] runWireless _ = return ""
src/Plugins/XMonadLog.hs view
@@ -30,17 +30,19 @@ import XUtil (nextEvent')  -data XMonadLog = XMonadLog | XPropertyLog String+data XMonadLog = XMonadLog | XPropertyLog String | NamedXPropertyLog String String     deriving (Read, Show)  instance Exec XMonadLog where     alias XMonadLog = "XMonadLog"     alias (XPropertyLog atom) = atom+    alias (NamedXPropertyLog _ name) = name      start x cb = do         let atom = case x of-                XMonadLog      -> "_XMONAD_LOG"-                XPropertyLog a -> a+                XMonadLog             -> "_XMONAD_LOG"+                XPropertyLog      a   -> a+                NamedXPropertyLog a _ -> a         d <- openDisplay ""         xlog <- internAtom d atom False 
src/StatFS.hsc view
@@ -23,7 +23,7 @@ import Data.ByteString (useAsCString) import Data.ByteString.Char8 (pack) -#if  defined (__FreeBSD__) || defined (__OpenBSD__) ||  defined (__APPLE__)+#if  defined (__FreeBSD__) || defined (__OpenBSD__) ||  defined (__APPLE__) || defined (__DragonFly__) #define IS_BSD_SYSTEM #endif @@ -58,7 +58,7 @@ #endif   c_statfs :: CString -> Ptr CStatfs -> IO CInt -toI :: CLong -> Integer+toI :: CULong -> Integer toI = toInteger  getFileSystemStats :: String -> IO (Maybe FileSystemStats)@@ -79,5 +79,5 @@                        , fsStatByteCount = toI bcount * bpb                        , fsStatBytesFree = toI bfree * bpb                        , fsStatBytesAvailable = toI bavail * bpb-                       , fsStatBytesUsed = toI (bcount - bfree) * bpb+                       , fsStatBytesUsed = toI (bcount - bavail) * bpb                        }
src/XUtil.hsc view
@@ -2,10 +2,11 @@ ----------------------------------------------------------------------------- -- | -- Module      :  XUtil--- Copyright   :  (C) 2007, 2011 Andrea Rossato+-- Copyright   :  (C) 2007 Andrea Rossato+--                (C) 2011, 2012 Jose Antonio Ortega Ruiz -- License     :  BSD3 ----- Maintainer  :  andrea.rossato@unitn.it+-- Maintainer  :  jao@gnu.org -- Stability   :  unstable -- Portability :  unportable --@@ -28,15 +29,13 @@     , fi     , withColors     , DynPixel(..)-    , xrrSelectInput-    , xrrQueryExtension     ) where  import Control.Concurrent import Control.Monad.Trans import Data.IORef import Foreign-import Foreign.C.Types+-- import Foreign.C.Types import Graphics.X11.Xlib hiding (textExtents, textWidth) import qualified Graphics.X11.Xlib as Xlib (textExtents, textWidth) import Graphics.X11.Xlib.Extras@@ -45,7 +44,6 @@ import System.IO #if defined XFT || defined UTF8 # if __GLASGOW_HASKELL__ < 612-import Foreign.C import qualified System.IO.UTF8 as UTF8 (readFile,hGetLine) # else import qualified System.IO as UTF8 (readFile,hGetLine)@@ -260,12 +258,3 @@ setupLocale :: IO () setupLocale = return () #endif----  XRRSelectInput-#include <X11/extensions/Xrandr.h>-foreign import ccall unsafe "X11/extensions/Xrandr.h XRRSelectInput"-  xrrSelectInput :: Display -> Window -> EventMask -> IO ()----  XRRQueryExtension-foreign import ccall unsafe "X11/extensions/Xrandr.h XRRQueryExtension"-  xrrQueryExtension :: Display -> Ptr CInt -> Ptr CInt -> IO (Bool)
src/Xmobar.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveDataTypeable, CPP #-} ----------------------------------------------------------------------------- -- | -- Module      :  Xmobar@@ -33,6 +33,7 @@ import Graphics.X11.Xlib hiding (textExtents, textWidth) import Graphics.X11.Xlib.Extras import Graphics.X11.Xinerama+import Graphics.X11.Xrandr  import Control.Arrow ((&&&)) import Control.Monad.Reader@@ -42,7 +43,6 @@ import Data.Bits import Data.Maybe(fromMaybe) import Data.Typeable (Typeable)-import Foreign import System.Posix.Process (getProcessID) import System.Posix.Signals @@ -82,37 +82,43 @@ startLoop xcfg@(XConf _ _ w _ _) vs = do     tv <- atomically $ newTVar []     sig <- setupSignalHandler-    _ <- forkIO (checker tv [] vs sig `catch` \(SomeException _) -> putStrLn "Thread checker failed" >> return ())-    _ <- forkOS (eventer sig `catch` \(SomeException _) -> putStrLn "Thread eventer failed" >> return ())+    _ <- forkIO (checker tv [] vs sig `catch`+                   \(SomeException _) -> void (putStrLn "Thread checker failed"))+#ifdef THREADED_RUNTIME+    _ <- forkOS (eventer sig `catch`+#else+    _ <- forkIO (eventer sig `catch`+#endif+                   \(SomeException _) -> void (putStrLn "Thread eventer failed"))     eventLoop tv xcfg sig   where     -- Reacts on events from X     eventer signal =-      alloca $ \ptrEventBase ->-      alloca $ \ptrErrorBase ->       allocaXEvent $ \e -> do          dpy <- openDisplay ""-        --  keyPressMask is the same value as RRScreenChangeNotifyMask-        xrrSelectInput    dpy (defaultRootWindow dpy) keyPressMask+        xrrSelectInput    dpy (defaultRootWindow dpy) rrScreenChangeNotifyMask         selectInput       dpy w (exposureMask .|. structureNotifyMask) -        _ <- xrrQueryExtension dpy ptrEventBase ptrErrorBase-        xrrEventBase <- peek ptrEventBase-         forever $ do+#ifdef THREADED_RUNTIME           nextEvent dpy e+#else+          nextEvent' dpy e+#endif           ev <- getEvent e           case ev of             ConfigureEvent {} -> putMVar signal Reposition             ExposeEvent {} -> putMVar signal Wakeup-            _ ->-              --  0 is the value of RRScreenChangeNotify-              when ( (fromIntegral (ev_event_type ev) - xrrEventBase) == 0)-                   $ putMVar signal Reposition+            RRScreenChangeNotifyEvent {} -> putMVar signal Reposition+            _ -> return ()  -- | Send signal to eventLoop every time a var is updated-checker :: TVar [String] -> [String] -> [[(Maybe ThreadId, TVar String)]] -> MVar SignalType -> IO ()+checker :: TVar [String]+           -> [String]+           -> [[(Maybe ThreadId, TVar String)]]+           -> MVar SignalType+           -> IO () checker tvar ov vs signal = do       nval <- atomically $ do               nv <- mapM concatV vs@@ -209,7 +215,7 @@   return (r,win)  -- | Updates the size and position of the window-repositionWin :: Display -> Window -> XFont -> Config -> IO (Rectangle)+repositionWin :: Display -> Window -> XFont -> Config -> IO Rectangle repositionWin d win fs c = do   srs     <- getScreenInfo d   (as,ds) <- textExtents fs "0"@@ -241,7 +247,7 @@     ax L     = const rx     ax R     = right     ax C     = center-    pw i     = rw * (min 100 i) `div` 100+    pw i     = rw * min 100 i `div` 100     nw       = fi . pw . fi     h        = fi ht     mh h'    = max (fi h') h@@ -267,7 +273,7 @@   getProcessID >>= changeProperty32 d w p c1 propModeReplace . return . fromIntegral  getRootWindowHeight :: [Rectangle] -> Int-getRootWindowHeight srs = foldr1 max (map getMaxScreenYCoord srs)+getRootWindowHeight srs = maximum (map getMaxScreenYCoord srs)   where     getMaxScreenYCoord sr = fi (rect_y sr) + fi (rect_height sr) @@ -281,7 +287,7 @@     Bottom          -> [0, 0,  0, sb, 0, 0, 0, 0,  0,  0, nx, nw]     BottomW _ _     -> [0, 0,  0, sb, 0, 0, 0, 0,  0,  0, nx, nw]     BottomSize   {} -> [0, 0,  0, sb, 0, 0, 0, 0,  0,  0, nx, nw]-    Static _ _ _ _  -> getStaticStrutValues p rwh+    Static       {} -> getStaticStrutValues p rwh     where st = fi y + fi h           sb = rwh - fi y           nx = fi x@@ -365,8 +371,7 @@   let (conf,d)             = (config &&& display) r       Rectangle _ _ wid ht = rect r       totSLen              = foldr (\(_,_,len) -> (+) len) 0 sl-      fntsize              = fi (as + ds)-      valign               = fi ht - 1 - (fi ht - fntsize) `div` 2+      valign               = (fi ht `div` 2) + (fi (as + ds) `div` 3)       remWidth             = fi wid - fi totSLen       offset               = case a of                                C -> (remWidth + offs) `div` 2
xmobar.cabal view
@@ -1,5 +1,5 @@ name:               xmobar-version:            0.14+version:            0.15 homepage:           http://projects.haskell.org/xmobar/ bug-reports:        http://code.google.com/p/xmobar/issues synopsis:           A Minimalistic Text Based Status Bar@@ -16,7 +16,7 @@ cabal-version:      >= 1.6 build-type:         Simple -extra-source-files: README, NEWS,+extra-source-files: readme.md, news.md,                     samples/xmobar.config, samples/xmonadpropwrite.hs                     samples/Plugins/helloworld.config,                     samples/Plugins/HelloWorld.hs@@ -61,6 +61,14 @@   description: Enables localized date support   default: False +flag with_mpris+  description: MPRIS v1, v2 support+  default: False++flag with_threaded+  description: Use threaded runtime+  default: False+ executable xmobar     hs-source-dirs:     src     main-is:            Main.hs@@ -82,12 +90,15 @@     ghc-prof-options:   -prof -auto-all      if true-       ghc-options: -funbox-strict-fields -Wall -threaded+       ghc-options: -funbox-strict-fields -Wall        extra-libraries: Xrandr -    -- Use --disable-optimization configure flag-    -- if impl (ghc == 6.10.1) && arch (x86_64)-    --    ghc-options: -O0+    if flag(with_threaded)+       -- -threaded is a workaround 100% CPU busy loop+       -- (http://hackage.haskell.org/trac/ghc/ticket/4934)+       -- See also comments in https://github.com/jaor/xmobar/pull/36+       ghc-options: -threaded+       cpp-options: -DTHREADED_RUNTIME      if impl (ghc >= 6.12.1)        ghc-options: -fno-warn-unused-do-bind@@ -96,24 +107,36 @@     if impl (ghc < 7)        cpp-options: -DGHC6 -    build-depends: X11>=1.3.0, mtl, unix, parsec, filepath, stm, time+    build-depends:+      unix,+      time,+      filepath,+      X11 == 1.6.*,+      mtl == 2.0.*,+      parsec == 3.1.*,+      stm == 2.3.*      if flag(small_base)-       build-depends: base == 4.*, containers, process, old-time, old-locale, bytestring, directory-+       build-depends:+         base == 4.*,+         containers,+         process,+         old-locale,+         bytestring,+         directory     else        build-depends: base < 3      if flag(with_xft) || flag(all_extensions)-       build-depends: utf8-string, X11-xft >= 0.2+       build-depends: utf8-string == 0.3.*, X11-xft >= 0.2 && < 0.4        cpp-options: -DXFT      if flag(with_utf8) || flag(all_extensions)-       build-depends: utf8-string+       build-depends: utf8-string == 0.3.*        cpp-options: -DUTF8      if flag(with_inotify) || flag(all_extensions)-       build-depends: hinotify+       build-depends: hinotify == 0.3.*        other-modules: Plugins.Mail, Plugins.MBox        cpp-options: -DINOTIFY @@ -123,7 +146,7 @@        cpp-options: -DIWLIB      if flag(with_mpd) || flag(all_extensions)-       build-depends: libmpd >= 0.6+       build-depends: libmpd == 0.7.*        other-modules: Plugins.Monitors.MPD        cpp-options: -DLIBMPD @@ -134,6 +157,11 @@        cpp-options: -DALSA      if flag(with_datezone) || flag(all_extensions)-       build-depends: timezone-olson, timezone-series+       build-depends: timezone-olson == 0.1.*, timezone-series == 0.1.*        other-modules: Plugins.DateZone        cpp-options: -DDATEZONE++    if flag(with_mpris) || flag(all_extensions)+       build-depends: dbus-core >= 0.9.2.1, text >= 0.11.1.5 && < 0.12+       other-modules: Plugins.Monitors.Mpris+       cpp-options: -DMPRIS