You are not logged in.

#1 2007-12-22 23:23:01

marte
Member
Registered: 2007-09-26
Posts: 24

xmms status on awesome bar

hello,
i'm trying to put a "now playing" on the awesome (2.0) statusbar, so the song that is playing on xmms appears there all the time, and when there's nothing playing, "stopped" or something appear there.

i installed xmms info pipe (available on aur) plugin and now can do:

[marte@hal ~]$ cat /tmp/xmms-info
XMMS protocol version: 2467
InfoPipe Plugin version: 1.3
Status: Playing
Tunes in playlist: 1
Currently playing: 1
uSecPosition: 191938
Position: 3:11
uSecTime: 222406
Time: 3:42
Current bitrate: 128000
Samping Frequency: 44100
Channels: 2
Title: Devo - Hardcore Devo Vol. 1 - 15 - Mongoloid
File: ///home/marte/goo/soulseek/hardcore devo vol. 1/15 Mongoloid.mp3

so i can...

[marte@hal ~]$ echo 0 setstatustext "np: `cat /tmp/xmms-info | grep Title`" | awesome-client

and magically the line "Title: bla bla" appears on the bar.

so i wrote a file named "bar.sh":

while true
do
    echo 0 setstatustext "np: `cat /tmp/xmms-info | grep Title`" | awesome-client
done

"chmod u+x" on it, and now i can run ./bar.sh so the info is always updated.

but i never did this kind of stuff with bash and etc before and have some questions:
1. how to start bar.sh automatically? i put the line "exec bar.sh &" on xinitrc before the "exec awesome" line but it didn't work.
2. how to remove the word "Title:" from the /tmp/xmms-info output?
3. is there someway to improve the whole thing? i mean, the "while true" is a good option?
4. soon i'll try to make an if that prints "stopped" if is the case... my idea is to try "if `cat /tmp/xmms-info | grep Status` == "Status: Stopped""... is there a better way to do it?

thanks in advance.

Offline

#2 2007-12-23 11:56:26

gothmog.todi
Member
From: Austria
Registered: 2007-07-18
Posts: 120

Re: xmms status on awesome bar

1. try replacing the "exec basr.sh &" with "./bar.sh &"
2. echo 0 setstatustext "np: `cat /tmp/xmms-info | grep Title`" | sed 's/^Title: //' | awesome-client should do the trick
3. i'm not that into scripting myself, but it is probably a good idea to add a "sleep 1" or something like that to the loop to reduce cpu-load.
4. can't really help you with that.

Offline

Board footer

Powered by FluxBB