«

»

Sep
24

Wake up with Amarok and Kalarm ( or cron ) and qdbus

Well it is not ruby tip. Just a Linux and KDE tip.

I am playing with dbus and wonder if I can wake up with kalarm and amarok under KDE.
The answer is YES!!!

PS : I plan to use ruby implementation of D-Bus and make some apps with it.
let see if I have time for that …
I see that ruby-dbus project is not very active but if you have information about implementations of dbus, please leave a comment or send me an e-mail.

# ! /bin/bash
 
# Variable declaration
 
interval=20
increment=10
volume=30
volumemax=100
 
# Body of the script
 
amarok # Launch Amarok application
qdbus org.kde.amarok /Player Stop #Stop amarok
qdbus org.kde.amarok /Player VolumeSet $volume #Set the volume to initial value of $volume
qdbus org.kde.amarok /Player Play # Play some music
 
while [ "$volume" -lt "$volumemax" ] ; do
 
qdbus org.kde.amarok /Player VolumeSet $volume # Set the volume
 
volume=$(expr $volume + $increment) # Increase volume variable
 
sleep $interval # Wait 20 seconds
 
done 
 
qdbus org.kde.amarok /Player VolumeSet $volumemax # Set volume to its maximum

You can just save this code to a file named amarokalarm.sh and add it to kalarm.

I think you can execute this file with a cron job (DON’T FORGET to add environment variable DISPLAY=:0.0 )

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">