Author
Christopher Marshall (christopherlmarshall@yahoo.com)
Raw Notes on Writing KDE Desktop Scripts
# xmessage
# this would put a directory listing up in the xm window
ls | xmessage -file -
# this would echo the choice when it was done
xmessage -print -buttons b1,b2,b3 "choose one please"
# a delay prompt
xmessage -timeout 10 "please wait for a second"
# lockfile
# this is how you would usually use it
if ! lockfile -1 -r1 $lockfile ; then
echo "couldn't get lockfile"
fi
do_a_bunch_of_stuff
rm $lockfile
# audio prompts
ogg123 -d arts somefile.ogg
xmessage -timeout 10 "please enjoy the music while we serve you"
kill $!
# clickable script template combining these elements
#!/bin/bash
lockfile=~/lock1
#song=/usr/drive2/music/mcarey/track01.cdda.ogg
song=/usr/drive2/music/bach/track01.cdda.ogg
# guard against multiple clicks
if ! lockfile -1 -r1 $lockfile ; then
xmessage -timeout 5 "this command is already running. stop clicking so much, silly"
exit 1
fi
ogg123 -d arts file.ogg &
xmessage -timeout 10 "program running"
# kill the ogg process, "$!" is the last background process started
kill $!
rm $lockfile
