Difference between revisions of "Setting A Button On Your Remote To Restart mythfrontend"

From MythTV Official Wiki
Jump to: navigation, search
m (new code template)
Line 3: Line 3:
 
First, create the following script, which could be in your home directory, e.g. /home/mythtv/runmyth:
 
First, create the following script, which could be in your home directory, e.g. /home/mythtv/runmyth:
  
{{Box File|/home/mythtv/runmyth|
+
{{Code box|/home/mythtv/runmyth|
 
<pre>
 
<pre>
 
#!/bin/sh
 
#!/bin/sh
Line 27: Line 27:
 
Next, add the following to your ~/.mythtv/lircrc:
 
Next, add the following to your ~/.mythtv/lircrc:
  
{{Box File|~/.mythtv/lircrc|
+
{{Code box|~/.mythtv/lircrc|
 
<pre>
 
<pre>
 
begin
 
begin
Line 41: Line 41:
 
For good measure, this is how I run mythfrontend in my X startup.  For me, the file is ~/GNUstep/Library/WindowMaker/autostart:
 
For good measure, this is how I run mythfrontend in my X startup.  For me, the file is ~/GNUstep/Library/WindowMaker/autostart:
  
{{Box File|~/GNUstep/Library/WindowMaker/autostart|
+
{{Code box|~/GNUstep/Library/WindowMaker/autostart|
 
<pre>
 
<pre>
 
irexec &
 
irexec &

Revision as of 21:02, 3 April 2007

If you are using a remote control for your mythtv setup via lirc, you may find this helpful. I don't use mythwelcome yet, so I am running mythfrontend directly as with the pre 0.19 setup. From the main screen of mythfrontend, it is possible to exit the application, leaving you at the main window in X11/xorg. So, how do you restart it? I had found that basically I had to restart X (gdm, kdm, et al.) remotely via ssh since I do not have a keyboard or mouse attached to the machine. By running irexec, you can use one of the remote buttons to restart mythfrontend.

First, create the following script, which could be in your home directory, e.g. /home/mythtv/runmyth:


Script.png /home/mythtv/runmyth

#!/bin/sh
RUNNING=0;

for x in `ps -C mythfrontend | grep -v PID` end; do
    test $x != 'mythfrontend' && continue
    RUNNING=1;
done

if [ $RUNNING = 1 ]; then
    `mythtvosd --bcastaddr="127.0.0.1" \
        --template='alert' \
        --alert_text="MythFrontend is already running" > /dev/null 2>&1 &`
else
    `mythfrontend &`
fi

Make the script executable,

# chmod 700 ~/runmyth.

Next, add the following to your ~/.mythtv/lircrc:


Script.png ~/.mythtv/lircrc

begin
prog = irexec
button = GO
config = ~/runmyth &
end

In my case, I used the GO button on my Hauppauge remote. Note that the script is setup to not allow multiple starts of mythfrontend. It should send a message to the OSD in the event that you hit the GO button while mythfrontend is still running.

For good measure, this is how I run mythfrontend in my X startup. For me, the file is ~/GNUstep/Library/WindowMaker/autostart:


Script.png ~/GNUstep/Library/WindowMaker/autostart

irexec &
~/runmyth &