I associated the multimedia keys in the K MenuEditor with some scripts which handle functions like play, stop and forward. In this scripts you can do nice things like controlling XMMS when it is not the active window or control multiple applications with one key:
#!/bin/sh #check if kaffeine is running kaffeine=`dcop | grep kaffeine -c` if [ $kaffeine = '1' ]; then #kaffeine is running, control it dcop kaffeine Kaffeine togglePlayPause elif [ `pgrep tvtime` ] then #tvtime tvtime-command TOGGLE_PAUSE tvtime-command TOGGLE_MUTE else #no kaffeine, no tvtime #xmms play-pause xmms -t fi
This code does the following: - if kaffeine (KDE video player) is running, a play/pause signal is sent to it - if tvtime (TV application) is running (but not kaffeine), the picture is paused and the sound is muted in tvtime - if none of the above, XMMS (X Multimedia System, like Winamp) shall play/pause
#!/bin/sh kaffeine=`dcop | grep kaffeine -c` if [ $kaffeine = '1' ] then dcop kaffeine Kaffeine stop elif [ `pgrep tvtime` ] then tvtime-command TOGGLE_PAUSE tvtime-command TOGGLE_MUTE else xmms -s fi
#!/bin/sh if [ `dcop | grep kaffeine -c` = '1' ] then dcop kaffeine PlaybackControl posPlus elif [ `pgrep tvtime` ] then tvtime-command CHANNEL_UP elif [ `dcop | grep kwintv -c` -gt 0 ] then dcop kwintv KWinTVIface channelUp else #xmms forward xmms -f fi