这是我想用伪代码做的事情:
create process
{
while not (answer == yes in parent process)
{
mplayer alert.mp3
}
}
show dialog "Time is up! Press 'yes' to stop the alarm."
answer = get userinput
这是我最终使用的代码:
#!/bin/bash
sleep $1
lockfile=$(mktemp)
{
while [[ -f "$lockfile" ]]
do
kdialog --passivepopup 'Time is up!' 1
sleep 1
done
}&
kdialog --msgbox 'Time is up! Leave this dialog to stop notifications.'
rm $lockfile
感谢@abeaumet