Solaris Advanced User's Guide
검색에만이 책은
PDF로 이 문서 다운로드

Modifying the Keyboard

C

This appendix provides instructions for remapping your keyboard. It includes remapping options for special keyboard keys. It also provides information on how to disable and enable the Compose key on your keyboard.
For information on remapping your mouse buttons (for example, more convenient left-handed use of the mouse), see the Solaris User's Guide.

Disabling/Enabling the Compose Key


x86 - The Compose key is defined to be Ctrl-Shift-F1 on x86 systems.

If you do not use the Compose key, you can disable it so that you do not press it inadvertently. First, find out the keycode for Multi_key:

  $ xmodmap -pk | grep Multi_key  

Your system displays a line similar to:
nn 0xff20 (Multi_key)
The important piece of information is the two-digit keycode number at the beginning of the line, represented by nn. Use this keycode number to construct the following line in your .xinitrc file:

  xmodmap -e 'keycode nn = NoSymbol'  

To re-enable the Compose key, comment out the previous line in your .xinitrc file and restart the OpenWindows software.

SPARC Left-Handed Key Remapping

The key remapping script in this section (provided for the Type-4 and Type-5 keyboards) remaps most of the special keys on the left and right panels of the keyboard (that is, the keypads to the left and right of the main keyboard area).

SPARC - Note the following sections concerning "Left-Handed Key Remapping" apply only to SPARC-based machines.

SPARC Using the Remapping Script
Follow these steps to create and use your remapping script:
  1. Create a file called lefty.data using any text editor. This can be in any directory. Step 4 must occur in the same directory in which you create this file.

  2. Type in the script as shown in Table C-1 "The lefty.data Script.". Any line with an exclamation point in front of it is a comment line, and does not execute any operation.

  3. Save the changes and quit the editor.

  4. At the prompt, type:


  $ xmodmap lefty.data  

You must be in the same directory as the script file.
  1. Click a mouse button in the Workspace to make the script take effect.

    Once you have completed these steps you can use the keyboard so the keys are mapped for a left-handed person.

Type the following script into the file lefty.data, as described in Step 1.
Table C-1 The lefty.data Script

  !  
  ! lefty.data  
  !  
  ! Data for xmodmap to set up the left and right function keys for left-handed use on  
  ! Sun type-4 keyboard. To use this data type the following where <filename> is the  
  ! name of the file (i.e. lefty-data).  
  !  
  ! xmodmap <filename>  
  !  
  ! The comments below correspond to the keycode assignments following  
  immediately thereafter.  
  !  
  ! swap L2 (Again) with R1 (Pause)  
  ! swap L3 (Props) with R6 (KP_Multiply)  
  ! swap L4 (Undo) with R4 (KP_Equal)  
  ! swap L5 (Front) with R9 (KP_9)  
  ! swap L6 (Copy) with R7 (KP_7)  
  ! swap L7 (Open) with R12 (KP_6)  
  ! swap L8 (Paste) with R10 (Left)  
  ! swap L9 (Find) with R15 (KP_3)  
  ! swap L10 (Cut) with R13 (KP_1)  
  !  
  ! chng R3 (Break) to L1 (Stop)  
  ! chng R2 (Print) to R10 (Left)  
  ! chng R5 (KP_Divide) to R12 (Right)  
  !  
  ! chng Linefeed to Control-R  
  !  
  keycode 10 = R1 R1 Pause  
  keycode 28 = L2 L2 SunAgain  
  keycode 32 = R6 R6 KP_Multiply  
  keycode 54 = L3 L3 SunProps  
  keycode 33 = R4 R4 KP_Equal  
  keycode 52 = L4 L4 SunUndo  
  keycode 56 = R9 R9 KP_9 Prior  
  keycode 77 = L5 L5 SunFront  
  keycode 58 = R7 R7 KP_7 Home  

Table C-1 The lefty.data Script (Continued)

  keycode 75 = L6 L6 SunCopy  
  keycode 79 = Right R12 KP_6  
  keycode 100 = L7 L7 SunOpen  
  keycode 80 = Left R10 KP_4  
  keycode 98 = L8 L8 SunPaste  
  keycode 102 = R15 R15 KP_3 Next  
  keycode 121 = L9 L9 SunFind  
  keycode 104 = R13 R13 KP_1 End  
  keycode 119 = L10 L10 SunCut  
  keycode 30 = L1 L1 SunStop  
  keycode 29 = Left R10 KP_4  
  keycode 53 = Right R12 KP_6  
  keycode 118 = Control_R  
  add control = Control_R  

SPARC Undoing the Keyboard Remapping
There are two ways to switch the keys back to their original settings. The first is to exit the OpenWindows software and start it up again. The second method, which is much preferable if you may want to switch the keys back periodically, is to create a second script and initiate it any time you want to switch back.
Follow these instructions to create the second script:
  1. Use any editor to create a file called nolefty.data. This must be in the same directory that contains the lefty.data script.

  2. Type in the script as shown in Table C-2 "The nolefty.data Script.". Any line with an exclamation point in front of it is a comment line, and does not execute any operation.

  3. Save the changes and quit the editor.

  4. At the prompt, type:


  $ xmodmap nolefty.data  

For the nolefty.data file to take effect, you must enter the previous command in the same directory as the script file.
Table C-2 The nolefty.data Script

  !  
  ! nolefty.data  
  !  
  ! Data for xmodmap to reset the left and right function keys after being set for  
  ! left-handed use on the Sun t ype-4 keyboard.  To use this data type the following  
  ! where <filename> is the name of this file.  
  !  
  ! xmodmap <filename>  
  !  
  !Reassign standard values to left function keys  
  !  
  keycode 10 = L2 L2 SunAgain  
  keycode 32 = L3 L3 SunProps  
  keycode 33 = L4 L4 SunUndo  
  keycode 56 = L5 L5 SunFront  
  keycode 58 = L6 L6 SunCopy  
  keycode 79 = L7 L7 SunOpen  
  keycode 80 = L8 L8 SunPaste  
  keycode 102 = L9 L9 SunFind  
  keycode 104 = L10 L10 Sun Cut  
  !  
  ! Reassign standard values to right function keys.  
  !  
  keycode 28 = R1 R1 Pause  
  keycode 29 = R2 R2 Print  
  keycode 30 = R3 R3 Scroll_Lock Break  
  keycode 52 = R4 R4 KP_Equal  
  keycode 53 = R5 R5 KP_Divide  
  keycode 54 = R6 R6 KP_Multiply  
  keycode 75 = R7 R7 KP_7 Home  
  keycode 77 = R9 R9 KP_9 Prior  
  keycode 98 = Left R10 KP_4  
  keycode 100 = Right R12 KP_6  
  keycode 119 = R13 R13 KP_1 End  
  keycode 121 = R15 R15 KP_3 Next  
  !  
  ! Reassign the Linefeed key as such and remove from control map.  
  !  
  remove control = Control_R  
  5keycode 118 = Linefeed  

x86 Function Key and Control Key Remapping

You can remap the function keys of an x86 machine so that they function like the Help, Cut, Copy, Paste, Undo, and Front keys on a SPARC keyboard. You can also remap the right Control key to be a Meta key.

x86 - Note the following sections concerning "Function Key Remapping" apply only to x86-based machines.
Once you remap the keys, you cannot use kdmconfig to change setup or video information without first undoing the keyboard remapping.
x86 Using the Remapping Script
Follow these steps to create and use your remapping script:
  1. Create a file in your home directory called fkeys using any text editor.

  2. Type in the script as shown in Table C-3.

  3. Save the changes and quit the editor.

  4. At the prompt, type


  $ xmodmap fkeys  

You must be in the same directory as the script file.
  1. Click a mouse button in the Workspace to make the script take effect.

    Once you have completed these steps you can use the function keys as Help, Cut, Copy, Paste, Undo, and Front keys.

Type the following script into the file fkeys, as described in Step 1.
Table C-3 The fkeys Script

  keysym F2 = L10  
  keysym F3 = L6  
  keysym F4 = L8  
  keysym F5 = L9  

Table C-3 The fkeys Script (Continued)

  keysym F8 = L4  
  keysym F9 = L5  
  
  remove control = Control_R  
  keycode 0x47 = Meta_R  
  add mod1 = Meta_R  

x86 Undoing the Keyboard Remapping
There are two ways to switch the keys back to their original settings. The first is to exit the OpenWindows software and start it up again. The second method, which is preferable, is to create a second script and initiate it any time you want to switch back.
Follow these instructions to create the second script:
  1. Use any editor to create a file called normal. This file must be in the same directory that contains the fkeys script.

  2. Type in the script as shown in Table C-4.

  3. Save the changes and quit the editor.

  4. At the prompt, type:


  $ xmodmap normal  

You must type the command in the same directory as the script file.
Type the following script into the file normal, as described in Step 1.
Table C-4 The normal Script

  keycode   8 = grave asciitilde  
  keycode   9 = 1 exclam  
  keycode  10 = 2 at  
  keycode  11 = 3 numbersign  
  keycode  12 = 4 dollar  
  keycode  13 = 5 percent  
  keycode  14 = 6 asciicircum  

Table C-4 The normal Script (Continued)

  keycode  15 = 7 ampersand  
  keycode  16 = 8 asterisk  
  keycode  17 = 9 parenleft  
  keycode  18 = 0 parenright  
  
  keycode  19 = minus underscore  
  keycode  20 = equal plus  
  keycode  21 =  
  keycode  22 = BackSpace  
  keycode  23 = Tab  
  keycode  24 = Q  
  keycode  25 = W  
  keycode  26 = E  
  keycode  27 = R  
  keycode  28 = T  
  keycode  29 = Y  
  keycode  30 = U  
  keycode  31 = I  
  keycode  32 = O  
  keycode  33 = P  
  keycode  34 = bracketleft braceleft  
  keycode  35 = bracketright braceright  
  keycode  36 = backslash bar brokenbar  
  keycode  37 = Caps_Lock  
  keycode  38 = A  
  keycode  39 = S  
  keycode  40 = D  
  keycode  41 = F  
  keycode  42 = G  
  keycode  43 = H  
  keycode  44 = J  
  keycode  45 = K  
  keycode  46 = L  
  keycode  47 = semicolon colon  
  keycode  48 = apostrophe quotedbl  
  keycode  49 =  
  keycode  50 = Return  
  keycode  51 = Shift_L  
  keycode  52 =  
  keycode  53 = Z  
  keycode  54 = X  
  keycode  55 = C  
  keycode  56 = V  

Table C-4 The normal Script (Continued)

  keycode  57 = B  
  keycode  58 = N  
  keycode  59 = M  
  keycode  60 = comma less  
  keycode  61 = period greater  
  keycode  62 = slash question  
  keycode  63 =  
  keycode  64 = Shift_R  
  keycode  65 = Control_L  
  keycode  66 =  
  keycode  67 = Alt_L  
  keycode  68 = space  
  keycode  69 = Alt_R  
  keycode  70 =  
  keycode  71 = Control_R  
  keycode  72 =  
  keycode  73 =  
  keycode  74 =  
  keycode  75 =  
  keycode  76 =  
  keycode  77 =  
  keycode  78 =  
  keycode  79 =  
  keycode  80 =  
  keycode  81 =  
  keycode  82 = Insert  
  keycode  83 = Delete  
  keycode  84 =  
  keycode  85 =  
  keycode  86 = Left  
  keycode  87 = Home  
  keycode  88 = End  
  keycode  89 =  
  keycode  90 = Up  
  keycode  91 = Down  
  keycode  92 = Prior  
  keycode  93 = Next  
  keycode  94 =  
  keycode  95 =  
  keycode  96 = Right  
  keycode  97 = Num_Lock  
  keycode  98 = Home KP_7 KP_7  
  keycode  99 = Left KP_4 KP_4  

Table C-4 The normal Script (Continued)

  keycode 100 = End KP_1 KP_1  
  keycode 101 =  
  keycode 102 = KP_Divide  
  keycode 103 = Up KP_8 KP_8  
  keycode 104 = KP_5 KP_5 KP_5  
  keycode 105 = Down KP_2 KP_2  
  keycode 106 = KP_Insert KP_0 KP_0  
  keycode 107 = KP_Multiply  
  keycode 108 = Prior KP_9 KP_9  
  keycode 109 = Right KP_6 KP_6  
  keycode 110 = Next KP_3 KP_3  
  keycode 111 = Delete KP_Decimal KP_Decimal  
  keycode 112 = KP_Subtract  
  keycode 113 = KP_Add  
  keycode 114 =  
  keycode 115 = KP_Enter  
  keycode 116 =  
  keycode 117 = Escape  
  keycode 118 =  
  keycode 119 = F1  
  keycode 120 = F2  
  keycode 121 = F3  
  keycode 122 = F4  
  keycode 123 = F5  
  keycode 124 = F6  
  keycode 125 = F7  
  keycode 126 = F8  
  keycode 127 = F9  
  keycode 128 = F10  
  keycode 129 = SunF36  
  keycode 130 = SunF37  
  keycode 131 = Print SunSys_Req  
  keycode 132 = Scroll_Lock  
  keycode 133 = Pause Break  
  keycode 134 =  
  keycode 135 = Multi_key  
  keycode 136 = Mode_switch