| xmonad-contrib-0.8.1: Third party extensions for xmonad | Source code | Contents | Index

XMonad.Util.Loggers

Portability | unportable
Stability | unstable
Maintainer | <byorgey@gmail.com>

Contents

Usage

Description
A collection of simple logger functions which can be used in the XMonad.Hooks.DynamicLog.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 XMonad.Hooks.DynamicLog.ppExtras field of your XMonad.Hooks.DynamicLoc.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) | Source

`Logger` is just a convenient synonym for `X (Maybe String)`.

date :: String -> Logger | Source

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 | Source

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 | Source

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 | Source

Create a `Logger` from an arbitrary shell command.
Produced by Haddock version 2.4.2