MandrakeUser.Org - Your Mandrake-Linux Knowledge Base!


 
 

*DocIndex - X

Mouse in X II

* Switching Mouse Buttons
* Putting Side Buttons To Work
* Mouse Utilities

Related Resources:

3 Button Mouse mini-HOWTO
X Big Cursor mini-HOWTO
Mouse Support In XFree86
Mouse- Cursor -Configuration Mini-HOWTO

Revision / Modified: June 12, 2001
Author: Tom Berger

 

* Switching Mouse Buttons

The usual scheme for a three-button mouse is

  • Right button is button 1
  • Middle button is button 2
  • Left button is button 3

If you want to reverse this order (e.g. because you are a left-hander), use the command xmodmap -e "pointer = 3 2 1". To have that executed automatically every time you start X, create a file called '.Xmodmap' in your home directory and put the line pointer = 3 2 1 in it. Now create an automatic startup script.

* section index * top

* Putting Side Buttons To Work

(Note: This is a work in progress. If you know more let me know.)

Some mice have two extra buttons, usually located on each side of the mouse. For X, this increases the number of buttons on that mouse to seven (the wheel counts as two buttons). To check if all seven buttons are recognized by X, run

xmodmap -pp

If you see only five buttons and you have a Microsoft Explorer / Optical PS/2 or USB mouse, it's time to edit '/etc/X11/XF86Config-4' (this does not work with XFree86 3), as 'root'.

Go to the 'Pointer section' and edit the 'Options' lines for 'Protocol' and 'ZAxisMapping' thus:

Option "Protocol" "ExplorerPS/2"
Option "ZAxisMapping" "6 7"

Add the option:

Option "Buttons" "7"

If you now restart X, you will notice something strange: the mouse wheel won't work anymore, but instead you can scroll by using the side buttons. On the other hand, if you set the 'ZAxisMapping' option back to '4 5', buttons 6 and 7 will vanish again. The only workaround for this odd behavior seems to be using 'xmodmap' to remap the buttons:

xmodmap -e "pointer = 1 2 3 6 7 4 5"

Now everything's at its right place again. You might want to create an automatic startup script to have this mapping executed automatically every time you start X.

But what do those two buttons do? So far I've discovered that they scroll sidewards in 'Konsole', 'Galeon' and 'Opera' (not in 'Konqueror', though, I assume that's because it's excluded from 'imwheel').
In 'gvim' and 'KWrite' they move the cursor back and forth by one position, by two positions when the CTRL key is pressed, four positions when the left ALT key is pressed and when you press the right SHIFT key, the cursor is moved to the start or the end of the current line.

Mandrake user Roger Wilco adds: "I find it convenient to map button 3 to the thumb button, it is easier to press than the wheel :-) This way I can paste text by pressing the thumb button, in Galeon it opens a new tab, in Netscape a new window, etc.

Yes, that's certainly something to spend a lazy afternoon with ... ;-)

* section index * top

* Mouse Utilities

In this section I'm introducing some less known mouse utilities you might find useful.

Mouse cursors

Creating, editing and installing mouse cursors is explained in Scott Brady's Mouse-Cursor -Configuration Mini-HOWTO.
DeCurs comes with a selection of mouse cursors for instant replacement and allows you to create new cursors via an image editing program. In order to use this program, you will have to compile the sources since there's no RPM available at this time.

Mandrake Linux 8.2 comes with the icoutils package which allows you to use MS Windows icons and cursors in Linux. Install it and read '/usr/share/doc/icoutils-0.13.0/icoutils.html' for instructions.

Mouse gestures

KDE includes kgesture (menu: 'Applications' - 'Accessibility'). It looks like development has ceased after version 0.3.
'kgesture' allows you bind commands of KDE's internal DCOP (Desktop COmmunication Protocol) to mouse gestures. For this, you will have to find out the command DCOP executes to perform a certain task.
Let's say you want to bind the function 'kill window' to a gesture:

  1. Start 'kdcop' from the command line.

  2. Since killing windows is a task related to the window manager (kwin), open that subtree.

  3. Open 'KWinInterface' and you will find ASYNC killWindow()

  4. The command you have to supply for the gesture is

    dcop kwin KWinInterface killWindow

    (i.e.: "run dcop, go into the kwin subtree, go into the KWinInterface subtree, execute function 'killWindow'").

From this example it should be obvious that 'kgesture' isn't all that useful ;-). It is further restrained by the fact that you can't bind the DCOP commands of most applications, since their DCOP name has a unique session number attached (which changes for every instance of that application).

The FVWM window manager as of version 2.4.x and later supports executing commands via mouse gestures.

xstroke allows you to draw every character with the mouse and have it sent to an application window of your choice. It's a bit like 'graffiti' on handheld devices with the notable exception that gestures can be written in the applications themselves. You can define your own gestures and you can even configure it to draw translucent strokes with drop shadows *grin*. Only available in source format.

Clickless

KMouseTool relieves you from the tedious task of clicking the mouse button several hundred times a day. Every time the mouse movement is paused, a click is sent and clickless drag 'n' drop can be enabled, too. Currently only available in source format, the RPM available on the website does not work.

Cursor control

I don't know any real use for this one, but I found it a cute idea: xwarppointer allows you to control the cursor position from the command line (e.g. if you want the cursor at a certain position after X started). Check the page for instructions.
MoveMouse is a similar utility.

* section index * top

 
Legal: All texts on this site are covered by the GNU Free Documentation License. Standard disclaimers of warranty apply. Copyright LSTB (Tom Berger) and Mandrakesoft 1999-2002.