Tip #2: How to Customize MythTV's Menus

The fact that MythTV has so many features can be both a strength, and a weakness. With so many features, the menu structure can be quite difficult to navigate, and it's almost certain that there are some features you will *never* use.

Wouldn't it be nice to trim the MythTV menus to just what you use. Or, how about simply re-ordering them to suit your preferences? The good news is that you can, and quite easily.

First, a bit on how MythTV's menu system works.

The menu's are driven by XML files (located in /usr/share/mythtv/). Here is a snippet from the mainmenu.xml file:

<text>Watch TV</text>
<text lang="FR">Regarder la TV</text>
... [more languages snipped]

<text>Media Library</text>
<text lang="FR">Médiathèque</text>
... [more languages snipped]
<action>MENU library.xml</action>

The important parts are the menu title:
<text>Media Library</text>

and the action
<action>MENU library.xml</action>

There are two types of actions:

  1. link to another menu (MENU menuname.xml)
  2. launch an action (TV_WATCH_LIVE)

Needless to say, linking to another menu simply loads another menu XML file. Launching an action will run the MythTV feature that you select.

Don't start editing those files just yet! Let's run through an example and I'll show you how to safely go about editing the menus.

Example: Remove MythPhone and Netflix from Info Menu

Let's say that I never use MythPhone, or NetFlix, and I want to remove them from the Information menu. You might think.. "Hey, no problem, I'll just bring up /usr/share/mythtv/info_menu.xml up in my favorite editor (vi.. right?) and hack away!"

Nope... Once again, the MythTV devs have outdone themselves. You can make a local copy of the entire mythtv menu system in mythtv's home directory ~mythtv/.mythtv and when you fire up mythfrontend, it will read those files instead.

So.. go ahead..

$cp /usr/share/mythtv/*.xml ~mythtv/.mythtv

Just for reference, here is a quick screenshot of the offending menu (with MythPhone and NetFlix)

O.K. Now lets fire up vi and start editing your local copy of ~mythtv/.mythtv/info_menu.xml

Here is the menu entry for MythPhone

<action>PLUGIN mythphone</action>

Simply remove the section above (everything, including the <button> tags), and MythPhone will be removed from the menu.
Find the entry for NetFlix, and do the same.
Save the file, and re-run mythfrontend.

Viola, here's our new menu. sans MythPhone and NetFlix

As you can see, this process is quite simple.

Additional Notes:

Now, let's say MythTV upgrades to 0.20 and the devs add a new menu item. Unfortunately, you're custom menus won't be updated with the rest of MythTV, and this could leave you in a lurch. What I would recommend is making a diff file of your modified xml file with the original. Then after an upgrade, you should be able to re-apply your diff to the new menus. If you want to be safe, you can also diff your file with the new original and compare the two diff's, and handle the entire situation manually.

You can re-arrange any menu action and move it into any menu. You can create your own menus. One thing you can't do that I would love is to assign a shell action to a menu item.

UPDATE (6/17/2009):
As requested, here is an example of how I use MythTV's menu to launch Front Row (on the mac) and Hulu Desktop

<action>EXEC /Users/mythtv/bin/runfrontrow.sh</action>
<action>EXEC /Users/mythtv/bin/runhulu.sh</action>

Needless to say, I have scripts in my bin directory that actually execute the commands, but there you go.

Comments, Questions? Post 'em, I'll try and answer any question.

Coming up next: Transcoding profiles for HDTV folks.


Anonymous said...
9:50 PM

"One thing you can't do that I would love is to assign a shell action to a menu item."

You can - use the "EXEC" action.

Anonymous said...
3:28 PM

Hi. Look is possible make a personalized menu.
I think gift to my mother one Mythtv Box and need create a custom menu with:
- The son videos (and my mom see only the son videos)
- The Mom radios favorite (and only heard radio favorites)
...and etc...

Is possible make this menu? Please let me know. Regards. Paul

David said...
12:39 PM

Thanks so much for the EXEC tip, I have a few bash scripts that I can't live without, this really helps me out.

Anonymous said...
5:14 PM

BRAVO! Short, to the point, and exactly what I was wanting to do. Thank you!

Anonymous said...
9:28 AM

Awesome! Thanks for the info! Helped a lot!

Alan Murrell said...
1:28 PM

I know you only used the removal of "MythPhone" and "Netflix" for the tutorial, but an easier method for removing those from the emnu if you never use them is to uninstall the MythPhone and/or Netflix modules :-)

I didn't know you could create a local copy of the menus in the mythtv directory, which then overrides the system ones, so thanks for that tip! :-)

Interphero said...
9:38 AM

Thank you for this post. I am currently using two solutions, MythTV and XBMC. This post, along with the comment about the EXEC function will let me make my HTPC more "wife friendly."

Paulo Gomes said...
1:59 PM

can you put an xml example of how call XMBC from Myth?

Paulo Gomes

John said...
2:14 PM

I've updated the post with an example for launching Hulu Desktop and Front Row from MythTV.

Peter said...
7:26 PM

This is what a Linux how-to should look like. Thanks for making my life that little bit easier today.

Anonymous said...
11:34 PM

When I first stated using MythTV, I customized a bunch of the menus. Months later, after a software upgrade, it took me a long time to figure out why some of the cool new features didn't show up on my box: the new features were accessible through new menu items and my "customized" menus did not include them.

Anonymous said...
10:37 AM

Just a quick howto for mythtv 0.22:

cd OR
cd ~mythtv

mkdir -p .mythtv/themes/defaultmenu
cp /usr/share/mythtv/themes/defaultmenu/mainmenu.xml .mythtv/themes/defaultmenu

and then edit that last file

Anonymous said...
9:13 AM
This comment has been removed by a blog administrator.
Anonymous said...
7:47 PM

is the last bachelor still dating the girl [url=http://loveepicentre.com/]dating advice for fifty year olds[/url] russian dating for sale http://loveepicentre.com/ stocks backdating