First we update the sources and download the package which allows running of scripts from a remote button (lirc-x).
sudo apt-get update
sudo apt-get install lirc-x
Next we ensure that this programme (irexec) runs as a daemon (in the background) as soon as we login to gnome by adding it to the .bash_login script
nano .bash_login
add the following code and save
irexec -dnext we make a file contaning the settings for which button and what to with it. I like to use the red button from the MSE remote to do this if you would like to use any other button just change 'red' below to the name of the button you want to choose (for non MSE remotes I have never used the so not sure if this will work, please research elsewhere)
nano .lircrcadd the following code and save
begin
prog = irexec
button = Red
config = ~/restartXBMC.sh
end
We have now said every time the red button is pressed to run the script restartXBMC.sh. Now we have to make this script.
nano restartXBMC.shadd the following code and save
#!/bin/bash
ps aux|grep -i justcop |grep -v grep|grep -i xbmc.bin|awk '{print $2}'|xargs kill -9
sleep 2
xinit /usr/bin/xbmc
exitThe first line kills XBMC and then waits 2 seconds. The last line starts it back up again
Next we must make the script executable
chmod +x ~/restartXBMC.shAll done!
No comments:
Post a Comment