Skip to content Accesskey=4Skip to sub-navigation Accesskey=3View our Accessibility Options MIT Information Systems Home About IS&T Contact IS&T Site Map Search Advanced Search
Getting StartedGetting Services by Topic or Alphabetically Getting Help

On This Page

[Help]

  

Quick Links

Top Level

Related Links

Ask OLC a question

Athena Consulting Homepage

Helpdesk Stock Answers (for Mac/PC questions)


Using XMODMAP to modify key and mouse actions

The setup and location of the keys on some workstation keyboards can
be different from that of other keyboards.  It is possible to "remap"
the keys with the "xmodmap" program.  The program can read a file
("xmodmap filename") or command-line arguments ("xmodmap -e 'command'").

If you want to list the current keymap table, you can just type:

	xmodmap -pk | more
or
	xmodmap -pke | more

To print the current mouse pointer map/table:

	xmodmap -pp

To read the manual page:

	man xmodmap

If you want to see what keycodes or keysyms a given key has, you can
use the "xkeycaps" program in the SIPB locker, or the "xev" program
in the standard path.

The "xkeycaps" program is more like a graphical front-end to "xmodmap",
and allows you to see what each key does and modify it as well (it
displays a graphical keyboard that you can move your mouse over).  To
read the manual page and run it, just type:

	add sipb
	xkeycaps &
and
	man xkeycaps

"xev" will report all X events, including mouse movements, keypresses, 
and keyreleases.  Just type "xev" and position the window, then move 
the mouse into the window (ignore the spew of xev output) and type the 
key in question; check the latest keypress/keyrelease information for 
the keycode and keysym of that key.  It's useful not to move the mouse 
or press any other keys until you've read the information off, as any 
event will cause more output.

-----

To make the mouse buttons "left-handed", you would use:

	xmodmap -e "pointer = 3 2 1"

or run xmodmap on a file containing "pointer = 3 2 1".

To switch the CapsLock and Control keys you would use:

	remove Lock = Caps_Lock
	remove Control = Control_L
	keysym Control_L = Caps_Lock
	keysym Caps_Lock = Control_L
	add Lock = Caps_Lock
	add Control = Control_L

or to just convert the CapsLock into another Control key:

	remove Lock = Caps_Lock
	keysym Caps_Lock = Control_L
	add Control = Control_L

Supposing you have a DEC workstation and keyboard (somewhat unlikely
nowadays as they're gone from Athena).  You can make the Alt key
function like the "Compose Character" modifier by using:

	clear mod2
	add mod1 = Alt_L
	add mod1 = Alt_R

On the Sun keyboards, you can switch the Escape key functionality to
the blank key above the listed ESC key, make the listed ESC key a ` 
and ~ key, and change the existing ` and ~ key to a BackSpace key by
using:

	keycode 36 = grave asciitilde
	keycode 49 = Delete
	keycode 22 = Escape

Note that using explicit keycodes is not recommended because different
keyboards can use varied codes (so you might end up remapping the Space
to Escape by mistake).  This means that keycodes aren't portable between
different types of machines or keyboards.


(Last updated Aug 12, 1997)

MIT Home | Getting Started | Getting Services | Getting Help | About IS&T | Accessibility
Ask a technology question or send a comment about this web page.