Difference between revisions of "Xmonad/Config archive/Josh Rickmar's dzenscript"

From HaskellWiki
Jump to navigation Jump to search
m
m
Line 11: Line 11:
 
if [[ -n `pgrep xmms2d` ]]; then
 
if [[ -n `pgrep xmms2d` ]]; then
 
# another if statement, stopped or not
 
# another if statement, stopped or not
if [[ `nyxmms2 status | awk '{print $1}'` == "Stopped:" ]]; then
+
if [[ `nyxmms2 status` =~ '^Stopped: ' ]]; then
 
XMMS2=" ^fg(green)XMMS2 is stopped^fg() |"
 
XMMS2=" ^fg(green)XMMS2 is stopped^fg() |"
 
else
 
else

Revision as of 02:21, 18 July 2009

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

#!/usr/bin/env zsh

UPDATE=1
SYSTEM=`uname -sr`

while :; do
    DATE=`date +"%a %B %d, %I:%M %p"`
    # if xmms2d is running
    if [[ -n `pgrep xmms2d` ]]; then
        # another if statement, stopped or not
        if [[ `nyxmms2 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(orange)$DATE^fg()"
    sleep $UPDATE
done | dzen2 -fn '-*-terminus-medium-r-*-*-12-*-*-*-*-*-*-*' -bg '#222222' -fg '#aaaaaa' -w 1370 -ta r -x 950