I like to listen to music while I'm falling asleep. However, I don't like to have the music playing while I'm actually asleep, because loud bits tend to wake me at odd hours. My (sadly deceased) alarm clock radio had a nifty little "sleep" button that would play the radio for an hour and then turn itself off. So I wrote a tiny bash scriptlet that does the same for xmms.
#!/bin/bash sleep $1 && xmms -s
Usage is fairly trivial -- call it with a number of seconds as an
argument and it'll sleep that long and then stop xmms. Using
&& instead of ; means that you can hit
<ctrl>-C and it'll kill the timer without stopping the music.
I usually say xs 3600, pick up a good book and drift gently in the land of pink fluffy elephants.
Update: I've written v2 of this -- not much different, but it at least has a default.
#!/bin/bash if [ -x $1 ] then sleeptime=3600 else sleeptime=$1 fi echo "xmms will stop in $sleeptime seconds..." sleep $sleeptime && xmms -s
Since this is such a tiny little script I'll just drop it in the public domain. Go wild, people.
I'm currently working on v3 which is written in python and will accept either a delay (in hours, minutes, seconds, whatever) or a time to switch off. Overkill, but it gives me something to do when I'm lying in bed with insomnia.