HaskellWiki

Haskell | Wiki community | Recent changes
Random page | Special pages

 

Not logged in
Log in | Help

Request an account if you don't have one.

Xmonad/Config archive/Josh Rickmar's dzenscript

< Xmonad | Config archive

This script handles the right side of my statusbar. It shows my system using uname, my currently playing song from XMMS2, remaining battery life, and the date and time.

#!/bin/sh

UPDATE=1
SYSTEM=`uname -sr`

while :; do
    DATE=`date +"%a %B %d, %I:%M %p"`
    BATTERY=`sysctl -n hw.acpi.battery.life`
    # if xmms2d is running
    if pgrep xmms2d > /dev/null ; then
        # another if statement, stopped or not
        if [ `nyxmms2 status -f "\\${playback_status}"` = "Stopped" ]; then
            XMMS2=" ^fg(green)XMMS2 is stopped^fg() |"
        else
            XMMS2=" ^fg(green)`nyxmms2 status | grep -Eo '^[^:]+:[^:]+'`^fg() |"
        fi
    else
        XMMS2=""
    fi
    echo "^fg(red)$SYSTEM^fg() |$XMMS2 ^fg(#00FFFF)$BATTERY%^fg() | ^fg(orange)$DATE^fg() "
    sleep $UPDATE
done | dzen2 -fn '-*-terminus-medium-r-*-*-12-*-*-*-*-*-*-*' -bg '#222222' -fg '#aaaaaa' -w 840 -ta r -x 840

Retrieved from "http://haskell.cs.yale.edu/haskellwiki/Xmonad/Config_archive/Josh_Rickmar%27s_dzenscript"

This page has been accessed 562 times. This page was last modified 20:12, 15 August 2009. Recent content is available under a simple permissive license.