Setting A Button On Your Remote To Restart mythfrontend
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:
Make the script executable,
# chmod 700 ~/runmyth.
Next, add the following to your ~/.mythtv/lircrc:
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:
A Better Restart Script
If someone could tell me how to make the progress dialog actually functional, that would be great. For now, this works better than the above, and getting it fully functional is probably very time-intensive, if not impossible (does mythfrontend return anything when it's finished loading and ready for input?).
Also, a note on autostarting irexec. If you are using mythbuntu, irexec is already installed and will autostart itself as long as there is a valid ~/.lirc/irexec file (tested with version 9.10, may be present in earlier versions).
Auto Login Method
If you have MythTV set up to automatically login as per the Frontend Auto Login you may just want to kill mythfrontend so that your system will automatically restart mythfrontend. Good for those random times when myth decides to not play nice and you need to kill it.
What I did was create a new system lirc file,
Just change remote = mceusb as appropriate for your remote, or remove it altogether, and button = to whichever button you wish to assign it to.
I then created this Upstart script to launch irexec in daemon mode,
Now, if mythfrontend ever gives you trouble, just hit the good ol' Kill button on your remote and in a few seconds all should be good with the world.
Perhaps a simpler approach
It is possible, as we known, to set two actions for two separate programs on the same button. This method uses lirc's property of choosing the first matching action to triger Escape or start mythfrontend, according to its running status.
or, for mythbuntu users:
in either of those files, insert the following code:
begin remote = yourremotename prog = mythtv button = buttonyouwanttoset config = Escape repeat = 0 delay = 0 end begin remote = yourremotename prog = irexec button = sameasabove config = mythfrontend & end
Note: The order is important. Since irexec is running as a daemon in the background, it will always be possible to trigger its action, unless mythfrontend is running. If so, the first action will be triggered and the second one will be ignored.
- Ensure you are running irexec in daemon mode in the background
ps ax | grep irexec
- If not run irexec with the following command, start it by your method of choice (at boot, manually, etc)
irexec -d /home/path/.lircrc
- It is possible when starting a mythfrontend from a script you may need to add the -display option to set which X-display you wish to use. For use in a script:
mythfrontend -display :0.0
- Ensure you're starting it on the right display, you can see who's logged in and on what displays with:
- If you get an error message from mythfrontend about unable to connect to x server start irexec from your mythtv account