HPlogo Using the X Window System > Chapter 9 Customizing the Mouse and Keyboard

Changing Mouse Button Actions

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Glossary

 » Index

Normally, the mouse pointer buttons are mapped as follows:

Table 9-1 Default Mouse Button Mapping.

Button NumberButton on a 2-button mouseButton on a 3-button Mouse
Button 1Left button Left button
Button 2Both buttons simultaneously Middle button
Button 3Right buttonRight button
Button 4 Left and middle buttons simultaneously
Button 5 Middle and right buttons simultaneously

 

However, you can change these mappings. To generate buttons 4 and 5 on a three-button mouse, you must enable button chording as described later in this chapter.

Table 9-2 Alternative Mouse Button Mappings.

To press ButtonLeft Hand MappingOSF/Motif Mapping
 2-button mouse3-button mouse2-button mouse3-button mouse
Button 1Right buttonRight buttonLeft buttonLeft button
Button 2Both buttons simultaneouslyMiddle buttonRight buttonMiddle button
Button 3 Left buttonLeft buttonBoth buttons simultaneouslyRight button
Button 4  Middle and right buttons simultaneously Left and middle buttons simultaneously
Button 5 Middle and left buttons simultaneously Right and middle buttons simultaneously

 

The xmodmap utility can be used to change mouse button mappings. The syntax for changing mouse button mappings with xmodmap is:

xmodmap [-e -pp "[pointer = default pointer = number [number...]]"]

-e

Specifies a remapping expression. Valid expressions are covered in "Customizing Keyboard Input" later in this chapter.

default

Set mouse keys back to default bindings

number

Specifies a list of button numbers to map the mouse keys to. The order of the numbers refers to the original button mapping.

pp

Print the current pointer mapping.

For example, to reverse the positions of buttons 1 and 3 for left-handed mapping:

   xmodmap -e "pointer = 3 2 1"        2-button mouse

   xmodmap -e "pointer = 3 2 1 5 4"  3-button mouse

To establish OSF/Motif-standard button mapping:

   xmodmap -e "pointer = 1 3 2"        2-button mouse

   xmodmap -e "pointer = 1 3 2 4 5"  3-button mouse

xmodmap is discussed in more detail in “Modifying Modifier Key Bindings with `xmodmap'”.

© 1995 Hewlett-Packard Development Company, L.P.