I want to make a button on a keyboard to act like a mouse click, preferably using xmodmap. How do I do it?
Running Ubuntu 10.10.
The following steps would help you rewire your keyboard keys to mouse buttons.
I imagine you could accomplish this using xmodmap and the Pointer_Button1 keymap.
Look in the file /usr/include/X11/keysymdef.h for the exact spelling and capitalization, but it should be possible to map a keyboard key into a mouse button (1,2,3,etc), even a double click (see the header file, near line 460 or so)
MIGHT work, causing the W key to act as the left mouse button. I'd recommend using a different key, unless you don't use any W's, but whatever works for you. (no, I'm not going to try it myself, I need my W's!)
Also have a look at the man page for xmodmap, and certainly the contents of /usr/include/X11/keysymdef.h to get the spelling correct. Drop the XK_ prefix to use the keysym names for xmodmap.
Looks like it's (keysymdef.h) in the x11-proto-core-dev package for my Debian system... you may want to search for the file and its contents online, doubt you want to install all the -dev files involved to just get THAT one. GIYF.
Something tickling in back of my head about another way to do this, but nothing's coming to me just now.
OH! Depending on your needs, you might look into Keyboard Mouse Emulation, with turns the numeric keypad into a full featured two-button (no scroll wheel!) mouse.