An older howto explains a way to change the default mouse buttons emulation. The process described there, however, is not persistent, in the sense that they disappear once the computer is restarted. Here is a way to make these changes persistent. In case you do not care about mouse buttons emulation at all (e.g., you have a three-button mouse), this howto also explains how to disable it (and thus get two new working keys).
On a related matter, my trackpad supports tapping (as mouse clicks), but such a feature is disabled in the default YDL 2.2 configuration. This howto also explains how to enable (or disable) trackpad tapping.
Before you start
If you DO NOT want to change the keys that emulate mouse buttons (e.g., all you need is to disable the whole emulation thing), then skip this section. Otherwise, decide which key you want to use for each button. For instance, on my (Tibook) keyboard, I am normally using neither the Command key, nor the small Enter key, so I decided to use these as mouse buttons (not a very bright choice, mind you, as both Command and Enter are gone for good, even in MOL; but then I am not using any environment that needs Command or Enter anyway).
Now that you have chosen the keys, you need to find their codes. To do this, you have to go to a console. If you see on your screen a black background and some whitish text (no windows, no menus), and if when you move the mouse the cursor looks like a whitish block, then you are already there. If on the other hand you see windows, menus, and the like, you have to switch the virtual terminal (VT henceforth). To do this, press and hold Option, Control, and Fn (Just Option and Control if you don't have an Fn key), and then press some function key between F1 and F7. F7 (i.e., VT number 7) is probably taken by X. VT number 1 may be also taken. Your best bet is F2 (VT number 2), but keep trying until you see the login prompt. Log in (possibly as root, in order to do the following steps in the same terminal) and type at the prompt:
showkey [ENTER]Then press (and release) your choice for button 2 emulation. You will see something like this:
keycode 87 pressRecord this number. Then press your key of choice for button 3 emulation. You will see the same type of lines, e.g.,
keycode 87 release
keycodeRecord again this number. Wait for 10 seconds or so without pressing any key and the prompt will appear again.
keycode 88 release
Changing the behavior of your mouse or trackpad
I hereby assume that you are logged in as root.
Your mouse configuration is read at startup from a file; all you need to do is to change the content of that file. To do this, first you have to open that file in your favorite editor. Type:
vi /etc/sysconfig/mouse [ENTER]Feel free to change `vi' to the name of your really favorite editor (e.g., pico or emacs). The opened file contains many lines, but about four of them are of interest for our purpose. You may want to change (some of) these, as follows:
* To disable the mouse buttons emulation, change the line
#EMULATION=yes [ENTER](a `#' character instructs the system to simply ignore whatever lies between it and the end of the line; in effect, you thus erase the line--actually, you can just erase it altogether if you feel like it).
* To change the key that emulates button 2, change the line
EMU_BUT2=xxx [ENTER]where xxx is the code of the key you want to use for this purpose (you did record it, right?).
Note: My example assumes that key 87 (which is really F11) is the one that was previously used. The actual number specified there might be different.
* To change the key that emulates button 3, change the line
EMU_BUT2=yyy [ENTER]where yyy is the code of the key you want to use as button 3. Again, you may find there something else than 88, just erase the thing and replace it with your code of choice.
* To enable trackpad tapping, change the line
#TRACKPAD_OPT=notap [ENTER]After you performed the changes you wanted, save the file and reboot the machine (the changes take effect only after reboot).
You are done, enjoy the new settings.
1. One of the lines in the file you just edited (/etc/sysconfig/mouse) says something like this:
"Run yimouse to re-configure this file" For one thing, I assume that `yimouse' stands for `/usr/lib/yi/mouse.py,' as there no such thing as `yimouse' on my hard disk. In any case, DO NOT run the said tool; all it does is to reset the file to its default form--yes, exactly the one you were unhappy with (and hence changed).
2. In case you have a trackpad and you enabled tapping, here is how the whole thing works: One tap is simple, it is equivalent to a click (with button 1). Two taps in a quick sequence is equivalent to, you guessed it, a double click (three taps in sequence are a triple click for applications that understand it, etc). In addition, however, you can also do drag and drop by tapping away at them:
- place the cursor over the thing you want to drag (e.g., on the titlebar of a window you want to move);
- tap once, lift the finger, and place it again quickly and firmly on the trackpad (the dely between the tap and the subsequent finger placement should be smaller than the maximum allowable double click delay);
- move your finger on the trackpad to the desired location; the artifact you tapped on (e.g., the window) is dragged with your motion; you can also lift your finger and place it back on the trackpad (gently!)--the artifact is not released;
- once you arrive to the desired location, tap once; the artifact will be dropped.
3. One final word about tapping: It really improves my productivity, and I do like it. However, it does have one disadvantage: Suppose that you lift your finger from the trackpad and place it back just because you reached an edge of the trackpad. If you do this with enough energy, it may be interpreted as a tap (i.e., click).
So, if you get plenty of undesired clicks, you may be better off by disabling back tapping (just do the reverse of the procedure described above). I believe that tapping sensitivity depends on both the mouse motion threshold and the keyboard repeat rate, but I don't know for sure how to change the sensitivity.
This HOWTO was written by Stefan Bruda