Tip #1: MythTV's New Edit Keys Feature (0.19)

New to MythTV version 0.19 is the Edit Keys feature. As with any new feature in MythTV, there is little documentation on how to use it. I decided to take a look at it and see just how it works, and I was quite pleased with how easy and intuitive it was to use.

What is Edit Keys?


The Edit Keys screen allows you to remap any of the keyboard/remote control keys in all of the MythTV contexts. This includes jumppoints, TV Playback, Web Browsing, everything. It's quite powerful, and if you go too far, you can mess yourself up. Fortunately, if you try to re-map an already existing binding, the UI will warn you.

Update: As noted in mythtv-users you will need mythcontrols in order for the Edit Keys menu to be active.

Make a backup first


If you are uneasy about modifying your key bindings, then all you have to do is backup the keybindings table prior to making any changes.

$ mysqldump -p --host <hostname if remote> --databases mythconverg --table keybindings > keybindings.sql

And to restore:

$ mysql -p --host <hostname if remote> mythconverg < keybindings.sql



Let's see an example


O.K. Now that we've got that out of the way.. On to the example/tutorial. I use the Radio Shack 15-2116 remote (an awesome JP1 programmable remote), and one of my biggest pet peeves is the fact that the 'Select' key behaves differently between MythTV's internal player, and mplayer.

When viewing a video with mplayer, the 'Select' key toggles pause/play (nice!), and when viewing TV with MythTV's internal player the 'Select' key bookmarks the video. Toggle playback is done with the 'Pause' key instead. The 'Select' key is my favorite on this remote, because it's a big, fat, key right in the middle of the remote, and the 'Pause' key is small, and awkwardly placed towards the bottom.

This needs to be fixed. My goal here is to remap MythTV's internal TV Playback pause/play to the 'Select' key on my remote.

Edit Keys to the rescue!

From the main menu, select Utilities/Setup -> Edit Keys.

Figure 1: Edit Keys screen (click to enlarge).

The column on the left are all of the different contexts that can be configured. Each context can have its own keybindings.

For this example we'll just scroll down to the 'TV Playback' context.

Figure 2: Edit Keys screen - TV Playback (click to enlarge).

Moving to the right, and scroll down to the action you want to edit. In our case, that would be 'Pause' (which is really 'Toggle Play/Pause').

Figure 3: Edit Keys screen - Pause action selected (click to enlarge).

After selecting Pause, you drop down to the next open slot below. Note: each action can be assigned three keys.

Figure 4: Edit Keys screen - Next open slot (click to enlarge).

Next, we want to go ahead and add our new key assignment. Press enter (keyboard, or remote) and you will be prompted (Waiting for keypress):

Figure 5: Edit Keys screen - Waiting for keypress (click to enlarge).

Press the key on the remote (or keyboard) that you want to map to 'Pause'. In my case, this is the 'Select' key on my remote, which lirc defines to be the keyboard 'Return'.

Figure 6: Edit Keys screen - Add key 'Return'? (click to enlarge).

After accepting the new assignment, you may get a warning about conflicting with the global context, but that's just fine, because we are defining this key for just the TV Playback context.

Figure 7: Edit Keys screen - Global Context warning? (click to enlarge).

After selecting 'Bind Key', you will now see the new key binding in the slot on the bottom.

Figure 8: Edit Keys screen - Global Context warning? (click to enlarge).

That's IT! You now have a new key bound to the 'Pause' action. When you exit the screen, you'll be prompted to save your changes:

Figure 9: Edit Keys screen - Save Changes? (click to enlarge).
Select 'Yes' and you're off to the races!

If you have any questions, or comments, please be sure to leave them below.

Coming up next: Customizing MythTV Menus

Back up to: The 'Myth' of HDTV


Tags: ,

4 comments:

Chad said...
8:44 PM

Very very nice tip! Quick question:
When you add the new keybinding, you said you can have up to 3 keys defined to that function. So does the original button still remain as 1 of the options for that function? For example, in your case now the Select button is your pause/play, does your smaller 'pause' button still perform that action as well?

John said...
9:29 PM

Thanks. Yes, the original button still works. For me personally, I ended up re-mapping that button to a different function.

hello said...
8:39 PM

Good info. You say that you can remap any key in all of the MythTV contexts. I would like to remap ESC so it does not exit out of LiveTV (I created a jumppoint to get back to the main menu). I cannot find any 'escape' feature in TV Playback, only in the global settings. I would still like ESC to exit everything but LiveTV. How do I add ESC to TV playback and remap what it does in only LiveTV?

NeroMaverick said...
8:04 PM

Edit keys is really helpful when using a remote like the one for PS3, all the buttons map to keyboard commands when you use the "cakemote.py" script. Very easy and seamless config.