Menu theme development guide
- 1 Introduction
- 2 Overview
- 3 Setting Up
- 4 Editing a Main Menu
- 5 Buttons
- 6 More Menus
- 7 Testing
- 8 Helpful Tips
- 9 Appendix A: Types
- 10 Appendix B: Actions
Menu themes allow the user to customize where certain myth features are located. By creating a customized menu theme, users can tailor MythTV to their own usage. The goal of this guide is to familiarize users with the menu's XML format and to create a comprehensive list of actions that will allow the user to invoke plugins and other menus. This document assumes that the main mythtv theme directories are in the "/usr/share/mythtv/themes" directory. If MythTV is installed in the "/usr/local" directory, substitute everywhere that says "/usr/" with "/usr/local/".
Go to the MythUI Theme Development for information about creating themes.
Menu themes are a series of XML documents used by the MythFrontend application to define what items are shown on each menu. Each XML document describes one menu. Keep in mind that many of the pages within the MythTV user interface are not menus. Also, the XML documents in a menu theme control what text or message will appear for each item in the menu, and what happens when that item is selected. The appearance of the menu and menu items, and what graphics are associated with them, are controlled from the UI theme's XML files, not the menu theme's.
The easiest way to get into menu theme development is to start by making changes to an existing theme. Select the menu theme you'd like to change from within MythFrontend (that should be found in Setup, Appearance). Launch a command line (if you need to). Normally, this will put you in your home directory. If you've already launched MythFrontend on your machine, then the .mythtv directory should have already been created, but if not, the following command will create it.
$ cd $ if [ ! -d .mythtv ] ; then mkdir .mythtv; fi; cd .mythtv;
Create a 'themes' directory if it doesn't already exist, and move into that directory:
$ mkdir themes; cd themes
Now create a directory with the same name as the menu theme you want to change. If you're using 'mediacentermenu,' then do this:
$ mkdir mediacentermenu; cd mediacentermenu
NOTE: You cannot override the defaultmenu theme, you must choose a different theme (such as mediacentermenu) and modify it instead.
Now you're set up to experiment with editing the menus without having to change the original files. MythFrontend will check both its own themes directories for XML files, and the themes directory you just created. Any files appearing in your personal themes directories will override the regular ones, so you can copy theme files to the appropriate place in your .mythtv directory to edit them, but if you want to revert back to the way it was, just delete your file or recopy it from the main. Make sure you have configured MythFrontend to use the menu theme you are overriding.
Editing a Main Menu
To edit the main menu, start by retrieving a copy of the existing main menu file.
$ cp /usr/share/mythtv/themes/defaultmenu/mainmenu.xml .
Note: if you're working with MythFrontend.app on a Mac, the theme files are contained in the app itself. If MythFrontend is installed in the default location, then you can access the theme files like this:
$ cp /Applications/MythFrontend.app/Contents/Resources/share/mythtv/themes/defaultmenu/mainmenu.xml .
Edit the file with your preferred editing tool. The first line of the document will always be
After the mythmenu tag, one or more button tags will define the buttons shown on the screen. Finally, the document will end with
A button defines what text appears on the screen and what action will be taken when the user selects the button.
<button> <type>SOME_TYPE</type> <text>My Text</text> <text lang="XX">My Text in XX</text> <description>Longer description of actions</description> <action>SOME_TYPE_ACTION</action> <depends>myplugin</depends> </button>
Below is a description of each tag
- <type> This tag defines what kind of button this is. This will determine what picture is shown when the button is highlighted. A list of known types can be found in Appendix A: Types.
- <text> The default text that appears on the screen. This is generally written in English.
- <text lang="XX"> Text that will appear if the user's locale is XX. There may be more than one of these tags
- <description> A description of this menu item which will optionally be shown in a theme when it is selected
- <action> The action that will result when the user selects the button. A complete list of known actions can be found in Appendix B: Actions
- <depends> Indicates that the button will only be shown if the indicated plugin is installed
One menu is usually not enough. To organize things, other menus can be created. A new menu will be an xml document of any name. New menus also start out with the tag <mythmenu name="NAME">. Replace "NAME" with an identifier of choice. Remember that the xml document must end with </mythmenu>.
Linking to another Menu
To link to another menu, create a button that looks like this:
<button> <type>MENU_TYPE</type> <text>Go to another Menu</text> <text lang="XX">Ogay otay notheray enumay</text> <action>MENU newmenu.xml</action> </button>
Conveniently, MythFrontend reads the XML files every time it enters a menu, so for every menu except the main menu, you can test it by saving the changes, then moving to the menu in MythFrontend. Make another change, save it, back up one level in MythFrontend, then go back down to the menu you're working on. This doesn't work with the main menu because there's no place to "back up" to; you'll have to quit and relaunch, or configure a hot key or menu item that commands MythFrontend to reload the UI.
To execute an external program through the MythTV menus and tell MythTV to ignore LIRC button presses until the program exits, add an EXEC action to the desired menu:
<button> <type>DVD</type> <text>Watch DVD</text> <action>EXEC xine --fullscreen dvd:/</action> <depends>mythdvd</depends> </button>
This should probably only be used on a personal level since another user may not have the custom program.
However, the action shown above--playing a DVD through xine--should probably be done directly using the following
<button> <type>JUMP_MYTHVIDEO</type> <text>Watch Videos</text> <action>JUMP MythVideo</action> <depends>mythvideo</depends> </button> <button> <type>JUMP_PLAY_DVD</type> <text>Play DVD</text> <action>JUMP Play DVD</action> <depends>mythvideo</depends> </button>
In the development of 0.25, the code was changed to not be specific to DVD discs, so the jump target changed, so you would instead use the following
<button> <type>DISC_PLAY</type> <text>Play DVD</text> <action>JUMP Play Disc</action> <depends>mythvideo</depends> </button>
If you're having trouble figuring out which file(s) you need to edit in order to change a particular part of the interface, there's a graphical map available that shows how the 'defaultmenu' theme works with the rest of the user interface
Appendix A: Types
Other graphical theme writers may include other types in their themes. These types are the ones referenced to in the default theme.
Appendix B: Actions
Note: the relationship between an action and what MythTV actually does when that action is invoked does not appear to be documented anywhere. The "uses window XXX" notes added here were determined by trial and error. A more complete reference for these actions can be found as part of the graphical map mentioned earlier.
- TV_STATUS - Status of the myth backend
- TV_WATCH_RECORDING - Go to the watch recording screen (uses window "watchrecording")
- TV_WATCH_LIVE - Watch live TV
- TV_SET_RECPRIORITIES - View/Set Recording Priorities (uses window "programrecpriorities")
- TV_FIX_CONFLICTS - Show upcoming recordings and conflicts (uses window "viewscheduled")
- TV_DELETE - Go to delete recordings screen
- TV_PREVIOUS - Show previously recorded shows (uses window "programlist")
- TV_SCHEDULE - Schedule a recording (uses window "programguide")
- TV_PROGFIND - Find a program to record (uses window "programfind")
- TV_MANUAL - Does an "Instant Recording"... Doesn't seem to work
- TV_CUSTOM_RECORD - Allow user to set a custom recording (uses window "customedit")
- TV_MANUALSCHEDULE - Manually record a show (uses window "manualschedule")
- TV_SEARCH_TITLE - Search for program by title
- TV_SEARCH_KEYWORD - Search for program by keyword
- TV_SEARCH_PEOPLE - Search for program by people
- TV_SEARCH_POWER - Advance Search
- TV_SEARCH_NEW - Search for new programs
- TV_SEARCH_MOVIE - Search for movies
- TV_SEARCH_CATEGORY - Search by category
- TV_SEARCH_CHANNEL - Search within a channel
- TV_SEARCH_TIME - Search within a time
Please note the space between SETTINGS and its argument
- SETTINGS MAINGENERAL - Main settings
- SETTINGS APPEARANCE - Appearance Settings
- SETTINGS XBOXSETTINGS - XBox Settings
- SETTINGS GENERALRECPRIORITIES - Recording priority settings
- SETTINGS CHANNELRECPRIORITIES - Channel recording priority
- SETTINGS EPG - Electronic Program Guide settings
- SETTINGS PLAYBACK - Playback settings
- SETTINGS RECORDING - Recording settings
- SETTINGS PLAYGROUP - ?
- SETTINGS GENERAL - ?
- EXEC someprogram - Executes a specified program
- Example: EXEC xine --fullscreen --no-splash dvd:/
- EXECTV someprogram %s %s %s - Executes a TV program. %s args are video, audio, and vbi devices
- Example: EXECTV xawtv -f -device %s -dspdev %s -vbidev %s
- MENU somemenu.xml - Jump to a new menu
- Example: MENU settings.xml
- UPMENU - Go to parent menu
- CONFIGPLUGIN myplugin - Configure a plugin
- Example: CONFIGPLUGIN mythdvd
- PLUGIN myplugin - Activate a plugin
- Example: PLUGIN mythdvd
- SHUTDOWN - Shutdown myth
- JUMP - Jump to specific Jump_points