Monday, April 29, 2002, 16:11:39, Derek Cunningham <[EMAIL PROTECTED]> wrote:
> Well, it IS possible to warp the position of the mouse cursor:
> http://freshmeat.net/projects/xwarppointer/?topic_id=861
> There's also a program called xbut (xbutton? :) here:
> http://www.sandklef.com/xbut/ which seems to handle button events...

After playing around with xwarppointer and xbut I can say I have quite
a happy little setup on my box. Here it goes:

First of all you need to compile the two. Please note the placement of
XFree, for me it's /usr/X11R6, some have it in /usr/X11 and so on.

Compile xwarppointer:
gcc -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 xwarppointer.c -o xwarppointer

Compile xbut:
gcc -I/usr/X11R6/include -I./ -g -c -o xbutlib.o xbutlib.c
gcc -I/usr/X11R6/include -I./ -g -c -o main.o main.c
gcc -o xbut xbutlib.o -L./ -L/usr/X11R6/lib -lX11 -lXtst main.o

I map some keys to xwarppointer thru bbkeys by putting the following
in my .bbkeysrc:
KeyToGrab(KP_Home), WithModifier(None), WithAction(ExecCommand), DoThis(xwarppointer 0 
0)
KeyToGrab(KP_Prior), WithModifier(None), WithAction(ExecCommand), DoThis(xwarppointer 
799 0)
KeyToGrab(KP_Next), WithModifier(None), WithAction(ExecCommand), DoThis(xwarppointer 
799 599)
KeyToGrab(KP_End), WithModifier(None), WithAction(ExecCommand), DoThis(xwarppointer 0 
599)
KeyToGrab(KP_Begin), WithModifier(None), WithAction(ExecCommand), DoThis(xwarppointer 
399 299)

What the above does is map KeyPad keys Home(7), Prior(9), Next(3),
End(1) and Begin(5) to xwarppointer actions which will take the mouse
cursors to the four corners of the desktop and to the center,
respectively (I use 800x600 at all times). Other neat tricks would be
positioning it over your toolbar or slit and cause a "pop-up" effect,
in case you keep them hidden like I do.

Xwarppointer also has an option for a custom delay. If you manage to
read the current mouse coords somehow (xwarppointer doesn't do this)
you could: read coords; move over the toolbar and make it pop-up to
see what time it is; sleep for half a second; move the pointer back.

As for xbut, here's my ~/.xbutrc:
91, 0, Button3
90, 0, Button1
108, 0, Button2
80, 0, MotionUp
83, 0, MotionLeft
85, 0, MotionRight
88, 0, MotionDown

Note that xbut takes keycodes (use xev) instead of keynames, unlike
bbkeys. Once you put "xbut &" in your .xinitrc, xbut stays in the
background and transforms key combinations to mouse events. What I've
done here is map KeyPad Ins(0), Del(.) and Enter to mouse buttons
left, right and middle, respectively, as well as use the KeyPad arrows
to nudge the mouse pointer.

With this setup I can press KeyPad 7 (make the pointer fly to the
top-left corner which is always free of windows for me) then KeyPad
Del and voila, you have the BlackBox menu open. Use the KeyPad arrows
to navigate it and KeyPad Ins to "click".

This setup also eliminates almost any need for a mouse. I just wish
someone would merge xbut and xwarppointer and make one nice little
tool. Or even better, merge them both into bbkeys. Now that would rock.

On a side note, I haven't tested which of bbkeys and xbut takes
precedence over mapping an identical key combo. I suspect it would
have something to do with the order I launch them in .xinitrc.

Ciprian Popovici

Reply via email to