xmonad-contrib-0.7: Third party extensions for xmonadContentsIndex
XMonad.Util.Loggers
Portabilityunportable
Stabilityunstable
Maintainer<byorgey@gmail.com>
Contents
Usage
Description
A collection of simple logger functions which can be used in the ppExtras field of a pretty-printing status logger format. See XMonad.Hooks.DynamicLog for more information.
Synopsis
type Logger = X (Maybe String)
date :: String -> Logger
loadAvg :: Logger
battery :: Logger
logCmd :: String -> Logger
Usage

You can use this module by importing it into your ~/.xmonad/xmonad.hs:

 import XMonad.Util.Loggers

Then, add one or more loggers to the ppExtras field of your PP format. For example:

     -- display load averages and a pithy quote along with xmonad status.
   , logHook = dynamicLogWithPP $ defaultPP { ppExtras = [ loadAvg, logCmd "fortune -n 40 -s" ] }

Of course, there is nothing really special about these so-called 'loggers': they are just X (Maybe String) actions. So you can use them anywhere you would use an X (Maybe String), not just with DynamicLog.

Additional loggers welcome!

type Logger = X (Maybe String)
Logger is just a convenient synonym for X (Maybe String).
date :: String -> Logger
Get the current date and time, and format them via the given format string. The format used is the same as that used by the C library function strftime; for example, date "%a %b %d" might display something like Tue Feb 19. For more information see something like http://www.cplusplus.com/reference/clibrary/ctime/strftime.html.
loadAvg :: Logger
Get the load average. This assumes that you have a utility called /usr/bin/uptime and that you have sed installed; these are fairly common on GNU/Linux systems but it would be nice to make this more general.
battery :: Logger
Get the battery status (percent charge and charging/discharging status). This is an ugly hack and may not work for some people. At some point it would be nice to make this more general/have fewer dependencies.
logCmd :: String -> Logger
Create a Logger from an arbitrary shell command.
Produced by Haddock version 0.8