thekvs / radiotray-lite

Online radio streaming player with minimum interface that runs on a Linux system tray
Other
50 stars 6 forks source link

Media Key support? #24

Open brentr opened 6 years ago

brentr commented 6 years ago

Is there any plan to add basic support for media keyboard keys like pause/stop/play/next/previous?

I'd be interested in adding this if you have no immediate plans to do so.

brentr commented 6 years ago

In the meantime, this little shell script works surprisingly well:

#!/bin/sh
#pause/pay current radio stream
: ${radio:=radiotray-lite}
case "$1" in
 play)
  killall -CONT $radio
;;
 stop)
  killall -STOP $radio
;;
 pause)
  pid=`pidof $radio` || {
   echo "No active $radio process" >&2
   exit 1
  }
  signal=STOP
  [ `ps -o state= -p $pid` = T ] && signal=CONT
  kill -$signal $pid
;;
 *) self=`basename $0`
    cat 2>&1 <<END
$self play, stop, or pause $radio process -- 9/15/18 brent@mbari.org
$self pause toggles between $self play and $self stop
END
esac