[NBLUG/talk] My Linux alarm clock

Lincoln Peters sampln at sbcglobal.net
Mon Jan 16 22:43:16 PST 2006


Yet another cool project that demonstrates why Linux rules...

Since I have a computer in my bedroom, and the computer has a fairly large 
stereo connected to it, I have set it up to function as an alarm clock for 
me.  I find this setup preferable to a more traditional alarm clock because I 
can control what I wake up to (no CD's to juggle, and you never know when a 
radio station is going to commercials), I can fine-tune it to fit my schedule 
(I don't always wake up at the same time every day of the week), and I can 
set up a fall-back alarm in case the first alarm doesn't get me out of bed.

The script I wrote requires you to have fairly recent versions of amaroK and 
k3b, which you are likely to have if you have an up-to-date installation of 
the KDE desktop.  There are two possible versions of this script: one for if 
you leave amaroK running continuously in your system tray, and one for if you 
don't.  If you DO leave amaroK running continuously, set this script to run 
when you need to wake up:

#!/bin/sh
export DISPLAY=':0.0'
amarok --play
sleep 30m && artsplay /usr/share/sounds/k3b_success1.wav


If you DON'T leave amaroK running continuously, set this script to run 1 
minute before you need to wake up:

#!/bin/sh
export DISPLAY=':0.0'
amarok &
sleep 60 && amarok --play
sleep 30m && artsplay /usr/share/sounds/k3b_success1.wav


Making it run automatically is a simple matter of adding it to your crontab.  
OK, so the crontab may be intimidating to some, but it's worth learning how 
to use it.

A further possible improvement would be to use X10 to start a coffee maker, 
create a simulated sunrise (using a lamp on a dimmer), or whatever other kind 
of home automation could be done (within the limits of the current 
technology) to make your mornings easier.  The only thing that's stopping me 
from doing this is that I still haven't been able to justify the cost of X10 
hardware for the things I'd use it for.  Oh, and if you're going to be 
traveling, it might be handy if you could do something like this with a Linux 
iPod and a set of portable speakers (unfortunately, I don't have an iPod 
capable of running Linux so I can't even try this).


And for those of you wondering why this script depends on k3b, it's because 
k3b includes this bugle sound effect that's perfect for when you're still in 
bed after the alarm has been running for half an hour.

-- 
Lincoln Peters
<sampln at sbcglobal.net>

Coward, n.:
	One who in a perilous emergency thinks with his legs.
		-- Ambrose Bierce, "The Devil's Dictionary"

/~\  The ASCII Ribbon Campaign
\ /    No HTML/RTF in email
 X     No Word docs in email
/ \  Respect for open standards



More information about the talk mailing list