summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2013-03-04 11:12:45 +0100
committerGravatar Tom Willemsen2013-03-04 11:12:45 +0100
commit8aad7173c48e848d582cf755082e1605a10bf6cb (patch)
treec864031f955e23f8fa0a205f768b31e169c9930f
parentb13108a00538601c46f3ed79038acd163cea8513 (diff)
downloaddotfiles-8aad7173c48e848d582cf755082e1605a10bf6cb.tar.gz
dotfiles-8aad7173c48e848d582cf755082e1605a10bf6cb.zip
xinit: Start MPD updater
-rwxr-xr-x.xinitrc26
1 files changed, 26 insertions, 0 deletions
diff --git a/.xinitrc b/.xinitrc
index cf85c60..ab65755 100755
--- a/.xinitrc
+++ b/.xinitrc
@@ -1,4 +1,26 @@
#!/bin/bash
+
+function update_mowedline_mpd ()
+{
+ while read action; do
+ if [ "$action" == "player" ]; then
+ IFS='' read -ra INFO <<< "`mpc status | tr '\n' `"
+
+ if [ "${INFO[1]}" == "" ]; then
+ mowedline-client -update mpd ""
+ else
+ TXT=" ${INFO[0]}"
+ ST="`echo ${INFO[1]} | sed 's/\[\(.*\)\] .*/\1/'`"
+ if [ "$ST" == "paused" ]; then
+ TXT="$TXT (paused)"
+ fi
+
+ mowedline-client -update mpd " $TXT"
+ fi
+ fi
+ done
+}
+
xmodmap ~/.Xmodmap
# Source scripts in /etc/X11/xinit/xinitrc.d/
@@ -15,5 +37,9 @@ mowedline &
xcompmgr -n -r 0 &
feh --bg-tile ~/pictures/wallpapers/wallpaper-864137.jpg
+{
+ mpc idleloop | update_mowedline_mpd
+} &
+
test -n "$1" && wm=$1 || wm="xmonad"
exec $wm