xmodmap Cntrl-CapsLock switch does not work

2007-12-25 8:00:00

Big thanks to the list, and a special thanks to Margarita Suarez for a quick

and correct response.

There are two different methods for solving this problem:

        1. (Hardware) Buy a type-5 UNIX keyboard or ask that Sun give one

           to you. It seems that several people complained rather

           vociferously to their respective Sun officies, and Sun

           swapped out their keyboards without too much trouble.

        2. (Config) There is an analog to the /usr/share/lib/keytables

           under OpenWindows; it is found in $OPENWINHOME/etc/keytables.

           By either modifying US5.kt in that directory or modifying that

           file and storing it in ~/.keytable, one can override the

           default keyboard layout effectively.

           There are two sections in the US5.kt file which need to be

           changed: MODMAP and KEYSYMMAP. MODMAP specifies the locations

           of special functions (shift, lock, control, etc). The codes for

           lock and control need to be swapped in this section. KEYSYMMAP

           specifies attributes for each of the keys. Here XK_Caps_Lock

           and XK_BackSpace need to be swapped and their locking capabilities

           swapped. There are plenty of instructions in the file itself.

We have ordered the UNIX type of the keyboard, but while we wait the second

solution has kept tempers under control. Another person suggested that

these changes should be kept to using xmodmap as much as possible. Personally,

I disagree. I'd rather have the changes in one format only, whether they

are applied to US5.kt or ~/.keytable is irrelevant.

Thanks go to:

   Margarita Suarez <marg@manila.cc.columbia.edu>

   ups!kevin@fourx.Aus.Sun.COM (Kevin Sheehan {Consulting Poster Child})

   courtney@cps.msu.edu

   danny@ews7.dseg.ti.com

   Michael_P._Kirby.roch803@xerox.com

Mark Mann Mars Observer Thermal Emission Spectrometer Project

(602) 965-0106 Mark.Mann@tes.la.asu.edu

-------Winning Entry----------

   Date: Tue, 1 Dec 92 19:34:09 EST

   From: Margarita Suarez <marg@manila.cc.columbia.edu>

   Subject: Re: xmodmap Cntrl-CapsLock switch does not work

   i had the same problem recently and was able to resolve it by editing

   the openwindows keytables file. there are two places where you should

   swap the functionalities of key 119 (lock) with key 76 (control): in

   the MODMAP section and also in the KEYSYMMAP section. then you won't

   need to use xmodmap to swap those two keys.

   changing the second section is what fixes your problem -- it lets you

   control "PSEUDOLOCK" keys which are "keys that do not physically lock in

   the down state."

   you can edit /usr/openwin/etc/keytables/US5.kt in place or copy it to

   ~/.keytable to override the default. note that if you start up xnews

   via xdm (which runs as root), ~/.keytable should be placed in root's

   home directory (probably /.keytable).

   if you are using a type-5 keyboard, you will most likely also have

   trouble using the number pad; you will have to make the following fix to

   /usr/openwin/lib/xdm/XTerm and /usr/lib/X11/xdm/XTerm as appropriate.

   hope this helps,

   marg

   --------

    Bug Id: 1095262

    Synopsis: In an Xterm window numlock does not work

    Description:

   The Numlock key problem described below also pertains to type 5 keyboards.

    Work around:

   This files deals with configuring an xterm to work with

   the NUM_LOCK key on a type-4 and type-5 keyboard.

   The following lines need to be added to either the user's own ~/.Xdefaults

   file or the system default file $OPENWINHOME/lib/app-defaults/XTerm.

   If there is a already an existing "Translations" entry, it will need

   to be relaced. e.g. The default file (XTerm) has this entry:

   XTerm*VT100.Translations: #override \

           <Key>L6:select-set(CLIPBOARD)\n\

           <Key>L8:insert-selection(CLIPBOARD)

        

   The lines that follow will replace the lines above:

   XTerm.VT100.Translations: #override \

           @Num_Lock<Key>KP_0: string(0)\n\

           @Num_Lock<Key>KP_1: string(1)\n\

           @Num_Lock<Key>KP_2: string(2)\n\

           @Num_Lock<Key>KP_3: string(3)\n\

           @Num_Lock<Key>KP_4: string(4)\n\

           @Num_Lock<Key>KP_5: string(5)\n\

           @Num_Lock<Key>KP_6: string(6)\n\

           @Num_Lock<Key>KP_7: string(7)\n\

           @Num_Lock<Key>KP_8: string(8)\n\

           @Num_Lock<Key>KP_9: string(9)\n\

           @Num_Lock<Key>KP_Add: string(+)\n\

           @Num_Lock<Key>KP_Decimal: string(.)\n\

           @Num_Lock<Key>KP_Divide: string(/)\n\

           @Num_Lock<Key>KP_Enter: string(\015)\n\

           @Num_Lock<Key>KP_Equal: string(=)\n\

           @Num_Lock<Key>KP_Multiply: string(*)\n\

           @Num_Lock<Key>KP_Subtract: string(-)\n\

           <Key>KP_Add: string(+)\n\

           <Key>KP_Divide: string(/)\n\

           <Key>KP_Enter: string(\015)\n\

           <Key>KP_Equal: string(=)\n\

           <Key>KP_Multiply: string(*)\n\

           <Key>KP_Subtract: string(-)\n\

           <Key>Prior:scroll-back(1,page)\n\

           <Key>Next:scroll-forw(1,page)\n\

           <Key>F16: start-extend() select-end(PRIMARY, CUT_BUFFER0, CLIPBOARD)

           \n\

          <Key>F18: insert-selection(PRIMARY, CLIPBOARD) \n\

           <Key>F27: scroll-back(100,page) \n\

           <Key>R13: scroll-forw(100,page) \n\

           <Key>Home: scroll-back(100,page) \n\

           <Key>End: scroll-forw(100,page)

   XTerm*tek4014.Translations: #override \

           @Num_Lock<Key>KP_0: string(0)\n\

           @Num_Lock<Key>KP_1: string(1)\n\

           @Num_Lock<Key>KP_2: string(2)\n\

           @Num_Lock<Key>KP_3: string(3)\n\

           @Num_Lock<Key>KP_4: string(4)\n\

           @Num_Lock<Key>KP_5: string(5)\n\

           @Num_Lock<Key>KP_6: string(6)\n\

           @Num_Lock<Key>KP_7: string(7)\n\

           @Num_Lock<Key>KP_8: string(8)\n\

           @Num_Lock<Key>KP_9: string(9)\n\

           @Num_Lock<Key>KP_Add: string(+)\n\

           @Num_Lock<Key>KP_Decimal: string(.)\n\

           @Num_Lock<Key>KP_Divide: string(/)\n\

           @Num_Lock<Key>KP_Enter: string(\015)\n\

           @Num_Lock<Key>KP_Equal: string(=)\n\

           @Num_Lock<Key>KP_Multiply: string(*)\n\

           @Num_Lock<Key>KP_Subtract: string(-)\n\

           <Key>KP_Add: string(+)\n\

           <Key>KP_Divide: string(/)\n\

           <Key>KP_Enter: string(\015)\n\

           <Key>KP_Equal: string(=)\n\

           <Key>KP_Multiply: string(*)\n\

           <Key>KP_Subtract: string(-)

        

        

   Note: There cannot be any trailing spaces after the ends of these lines.

           Also, almost all of the lines end with "\n\" except the last

           entry for each Translation.

        

   These translations should work with the default keymappings, so any

   changes made with xmodmap may break this.

   The following behavior should be seen when using these translations:

   - All Keypad (right) keys should generate "top" character when NUM_LOCK is

     on and generate "bottom" behavior when NUM_LOCK off.

  

   - Editpad (center) keys always behave as labeled, regardless of NUM_LOCK

     state. Home, End, Pageup, and PageDn should all work in xterm

  

   - Cut and Paste keys (left) work with xview buffer, so xterm and xview

     applications can transfer information.

Comments

Got something to say?

You must be logged in to post a comment.