View unanswered posts    View active topics

All times are UTC - 6 hours

Post new topic Reply to topic  [ 1 post ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Mon Nov 21, 2005 11:55 pm 
Joined: Sat Nov 05, 2005 11:28 am
Posts: 2
After getting my RF ATI Remote Wonder to work with MythTV and configuring the keys with xmodmap, I found that I ran into key mapping problems when I tried to use mplayer, xine, or xmame from within MythTv. My solution was to write a small wrapper script to handle setting and resetting the key mappings.

To use this script, simply save it to someplace in your path - I saved it as

Next go into Utilities/Setup / Media Settings / Videos Settings / Player Settings, preceed the regular command with the name of this script.

For example, my video player command was originally:
mplayer -fs -zoom -quiet -vo xv -ao alsa:device=mixed-digital -ac hwac3, %s
which I replaced with
keymap_wrapper mplayer -fs -zoom -quiet -vo xv -ao alsa:device=mixed-digital -ac hwac3, %s

You can similarly change the DVD Settings / Play Settings and the Games Settings / General Settings.

When the wrapper script runs, it will search your home directory for a xmodmap file named according to the program you are running in the form
which for the example above using mplayer becomes
If this xmodmap file is found, it dumps the current settings, whatever they are, to a file called
The player-specific key mappings are then loaded using xmodmap and the player program is called with all the arguments you passed to it. After the player exits, your original key mappings are restored.

The keymap_wrapper script is below. Any suggestions on how it might be improved will be appreciated.

# ***********************************************************************
#  Run this script to launch various applications from within MythTV by
#  preceeding the command to run with the path to this script.  This
#  script will look for a specific Xmodmap file for the player that you
#  want to run.  If found, it will run xmodmap to dump your current
#  settings.  Then it will load the settings specific to the player you
#  are launching.  The player will run with all the options you pass it
#  and afterwards, your original key bindings will be restored.
#  For example, if your DVD player command in mythtv was originally:
#    xine --audio-driver alsa -pfhq --auto-scan dvd
#  then you would replace it with:
#    keymap_wrapper xine --audio-driver alsa -pfhq --auto-scan dvd
#  This script will use the first argument, in this case 'xine' to look
#  for an xmodmap file called "$HOME/.Xmodmap_xine" which would hold
#  the key bindings you want to change for running xine.  After running
#  xine, your original key bindings will be restored.
# ***********************************************************************

# First argument should be the player we want - xine, mplayer, xmame, etc.
# and can be given with just the program name or the full path.
$app= $ARGV[0];
if ($app=~/\//) {
   @parts= split(/\//,$app);
   $app= $parts[-1];

# File and path settings

print "xm_current= $xm_current\n";
print "xm_player = $xm_player\n";

# Set player-specific keymap
if ( -f $xm_player ) {

  # Store current xmodmap bindings
  `xmodmap -pke > $xm_current`;

  # Set the new xmodmap bindings
  `xmodmap $xm_player`;


# Run the player with all the options you passed it
$command= "";
foreach $a (@ARGV) {
   $a=~ s/\"/\\\"/g;
   $a=~ s/\`/\\\`/g;
   $a=~ s/\'/\\\'/g;
   if ($a=~ /\s/) {
      $a= "\"$a\"";
   $command.= "$a ";
print `$command`;

# Restore original key bindings
if ( -f $xm_player ) {
  if ( -f $xm_current ) {
    `xmodmap $xm_current`;


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours

Who is online

Users browsing this forum: No registered users and 0 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu