Saturday 29 January 2011

Mouse support for mythTv possible with this easy hack!

MythTV was great, but it lacked built-in mouse support, I could move the mouse on the screen, but could not click nothing.  Checking the forums, it seems that the community has a backwards obsession in using only the keyboard for myth.

What I wanted is to use the scroll wheel on my cordless mouse to scroll through channels while watching tv and use the left mouse click to select the channel in the osd.  Which left me no choice but to use another program to emulate the keyboard with the mouse.
Simply what it does is make the left mouse button press space and the right mouse button press escape.

I did the following on Ubuntu 10.04 and myth v0.24, with no problems.

do

Code:

sudo apt-get install xbindkeys xautomation


then

Code:

xbindkeys --defaults > $HOME/.xbindkeysrc


then

Code:

nano ~/.xbindkeysrc


add this to the file

Code:

#space_bar_from_left_click
"xte 'keydown space' 'keyup space'"
b:1

#escape_from_right_click
"xte 'keydown Escape' 'keyup Escape'"
b:3


quit and save the file.

now test it, from the command line 'xbindkeys', left click gives a space 'right click' gives escape (which does little in the shell)

now try running mythfrontend (hide mouse option must be off, you want to see the pointer)

Code:

mythfrontend


scroll wheel to 'watch tv', press left mouse key once, while watching tv scroll channels using the wheel, select channel on the osd using the left mouse button and escape out of watching tv using the right button, simple enough. Remember left = space and right = escape

exit out of mythfrontend and kill the xbindkeys to regain control with the system

Code:

killall xbindkeys


now make a script that will start xbindkeys before starting mythfrontend, and auto kill xbindkeys after exiting mythfrontend.

Code:

nano ~/mythtvstart.sh



Code:

#!/bin/bash
# mythtvstart.sh
# loads mouse support for mythtv.

killall mythfrontend
killall xbindkeys
xbindkeys
mythfrontend
sleep 5
killall xbindkeys
killall mythfrontend


now make the script executable

Code:

chmod +x mythtvstart.sh


make a shortcut on the desktop / main menu to this script
left click on desktop, create launcher.... browse to command mythtvstart,sh

thats it, throw away the remote, put the keyboard under the bed, no more struggle. For all those doubters out there, you are more than welcome to go back to holding that remote in you hand, cos we know that is what you enjoy doing ;-0

Reference:

HTML Code:

http://hanschen.org/2009/10/13/mouse-shortcuts-with-xbindkeys/

No comments:

Post a Comment