I realised that my pc has the option to "auto-turn on" at a specific time and date. So I thought of making an alarm out of my computer.
After a lot of googling, searching, reading and trying (listening to Technology by Daft Punk) I found this out:
http://forums.fedoraforum.org/showthread.php?t=106321
So I decided to modify this script to my needs.
I didn't want to use kalarm either as I tra;y to be minimalist and I don't have a very powerful machine.
Well, after a lot more of google tis, google that, I finally have my alarm working. This is my crontab:
# m h dom mon dow command
34 05 * * 1-6 export DISPLAY=:0.0 ; xterm -e "/home/adan/alarm & bin/bash"
And this is the "alarm" script (I don't like naming every script with .sh I just don like it):
#!/bin/bash
amarok
sleep 20s
dcop amarok player setVolume 0
dcop amarok playlist togglePlaylist
dcop amarok playlistbrowser loadPlaylist "50 Random Tracks"
sleep 10s
dcop amarok player play
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
Explanations:
- You should specify the DISPLAY in order to run X apps from cron.
- I run a xterm that runs the script because of unresolved problems with DCoP.
- Xterm needs the /bin/bash at the end. If you don't use it it will just terminate and disapear after the last command.
- Volume goes to 80% with this script.
- You need to toggle to the playlist window because otherwise, amarok will not recognise the playlist.
- Uhm, and 34 minutes because we are so used to the 0s and 5s and we have always to approximate everything and I am not in agreement with that. If I want to meet someone at 10:58, why do people always says "well, that's 11 o'clock"? Do I add or substract minutes to their arrangements? I don't.
Here are the web pages (apart from the one with the script) that helped me do this:
- http://ubuntuforums.org/showthread.php?t=815881
- http://amarok.kde.org/wiki/DCOP_Functions
- http://linux.derkeiler.com/Newsgroups/alt.os.linux.suse/2004-01/3951.html
- http://www.linuxforums.org/forum/misc/115239-getting-prompt-after-xterm-e-command.html
I hope you all have found this useful.
Have a nice week.