Using KDE systray notifications from bash scripts

I just improved my Extract audio script to show a system notification when it’s finished. In the meantime I also have a “convert to mp3” script which proves useful if you don’t care about the original audio stream and/or you target a platform with limited decoding abilities:

ffmpeg -i %u -acodec libmp3lame -ar 44100 -ab 160k %u.mp3

To popup a KDE4 system tray notification at the end of the encoding process, simply add the following:

kdialog --passivepopup 'Finished converting %u' 3

The last value simply specifies the timeout in seconds. To chain the commands together, use a semicolon, so it also executes when the encode fails.