#!/bin/bash ### LIRC remote control client for XMMS2 with OSD ### # Copyright 2009 Ertug Karamatli # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . MP=mplayer MP_FILE=/tmp/mpctl MYTHTV=mythfrontend FILE=/tmp/irw.txt irw > $FILE & sleep 1 trap "killall irw; exit 0;" EXIT function osd { VOL=$(xmms2 volume_list | head -n1 | grep -o "[0-9]*") osd_cat -T "$1" -p bottom -c yellow -o10 -i10 -d1 -b percentage -P $VOL -f "-*-terminus-medium-*-*-*-80-*-*-*-*-*-iso8859-1" & } logger -s -t $0 "started." DPMS=0 while [ 1 ]; do BUTTON=$(cat $FILE | sed -n 's/.* .* \(.*\) .*/\1/p') if [ -n "$BUTTON" ]; then echo > $FILE logger -s -t $0 "button: $BUTTON" # if [ -z "$(ps -e|grep $MYTHTV)" ]; then case $BUTTON in FULLSCREEN) if [ -n "$(ps -e|grep $MP)" ]; then echo pause > $MP_FILE osd "PLAY ($MP)" else xmms2 toggleplay osd "PLAY (xmms2)" fi ;; VolumeUP) xmms2 volume +10 osd $BUTTON ;; VolumeDOWN) xmms2 volume -10 osd $BUTTON ;; POWER) if [ $DPMS == 0 ]; then osd "Screen On" xset dpms force on xset s reset DPMS=1 else osd "Screen Off" xset dpms force off DPMS=0 fi ;; 16-CH-PREV) osd "$(xmms2 current)" ;; esac # fi fi sleep 0.2 done