Chinaunix首页 | 论坛 | 博客
  • 博客访问: 955502
  • 博文数量: 116
  • 博客积分: 3923
  • 博客等级: 中校
  • 技术积分: 1337
  • 用 户 组: 普通用户
  • 注册时间: 2009-04-23 01:22
文章分类

全部博文(116)

文章存档

2013年(1)

2012年(17)

2011年(69)

2009年(29)

分类: LINUX

2011-09-05 21:34:59

今天去新公司报到,结果要直接在PC上安装ubuntu系统来开发,而不是用虚拟机,晕死,一下子弄的我简直像个白痴,每次想编辑一个文件,或者想进出目录,简直就是白痴,最后还是受不了,在ubuntu上安装了emacs,还好最后我发现有个很好的key remap工具提供给X11的键映射,爽 ~~~~

用emacs就肯定要对换一下Caps_Lock和Control_L这两个键,除非他喜欢自残,这个我没法阻止 ~~~

只需要在使用时输入命令就搞定: xmodmap swap_key

而且支持切换回来,太好了~~~

file: swap_key
  1. !
  2. ! Swap Caps_Lock and Control_L
  3. !
  4. remove Lock = Caps_Lock
  5. remove Control = Control_L
  6. keysym Control_L = Caps_Lock
  7. keysym Caps_Lock = Control_L
  8. add Lock = Caps_Lock
  9. add Control = Control_L

---------------------------------------------------------------------------------------------

还有补充一点关于在Microsoft Windows下改变映射键的工具,以前一直用那个RemapKey工具,经常被杀毒软件杀掉,明天尝试一下KeyTweak,看那赛门铁克还能不能克这个 ~~~ 不爽

附件:(顺便备份一下,每次都不知道塞到哪个角落里 ~~~)

 RemapKey.rar  

 KeyTweak_install.rar  
---------------------------------------------------------------------------------------------

下面是引用这个xmodmap的用法:

(转)


  1. hardy (1) xmodmap.1.gz
  2. Provided by: x11-xserver-utils_7.3+2_i386 bug

  3. NAME

  4. xmodmap - utility for modifying keymaps and pointer button mappings in
  5. X


  6. SYNOPSIS

  7. xmodmap [-options ...] [filename]


  8. DESCRIPTION

  9. The xmodmap program is used to edit and display the keyboard modifier
  10. map and keymap table that are used by client applications to convert
  11. event keycodes into keysyms. It is usually run from the user’s session
  12. startup script to configure the keyboard according to personal tastes.


  13. OPTIONS

  14. The following options may be used with xmodmap:

  15. -display display
  16. This option specifies the host and display to use.

  17. -help This option indicates that a brief description of the command
  18. line arguments should be printed on the standard error channel.
  19. This will be done whenever an unhandled argument is given to
  20. xmodmap.

  21. -grammar
  22. This option indicates that a help message describing the
  23. expression grammar used in files and with -e expressions should
  24. be printed on the standard error.

  25. -verbose
  26. This option indicates that xmodmap should print logging
  27. information as it parses its input.

  28. -quiet This option turns off the verbose logging. This is the
  29. default.

  30. -n This option indicates that xmodmap should not change the
  31. mappings, but should display what it would do, like make(1)
  32. does when given this option.

  33. -e expression
  34. This option specifies an expression to be executed. Any number
  35. of expressions may be specified from the command line.

  36. -pm This option indicates that the current modifier map should be
  37. printed on the standard output. This is the default mode of
  38. operation if no other mode options are specified.

  39. -pk This option indicates that the current keymap table should be
  40. printed on the standard output.

  41. -pke This option indicates that the current keymap table should be
  42. printed on the standard output in the form of expressions that
  43. can be fed back to xmodmap.

  44. -pp This option indicates that the current pointer map should be
  45. printed on the standard output.

  46. - A lone dash means that the standard input should be used as the
  47. input file.

  48. The filename specifies a file containing xmodmap expressions to be
  49. executed. This file is usually kept in the user’s home directory with
  50. a name like .xmodmaprc.


  51. EXPRESSION GRAMMAR

  52. The xmodmap program reads a list of expressions and parses them all
  53. before attempting to execute any of them. This makes it possible to
  54. refer to keysyms that are being redefined in a natural way without
  55. having to worry as much about name conflicts.

  56. keycode NUMBER = KEYSYMNAME ...
  57. The list of keysyms is assigned to the indicated keycode (which
  58. may be specified in decimal, hex or octal and can be determined
  59. by running the xev program). Up to eight keysyms may be
  60. attached to a key, however the last four are not used in any
  61. major X server implementation. The first keysym is used when
  62. no modifier key is pressed in conjunction with this key, the
  63. second with Shift, the third when the Mode_switch key is used
  64. with this key and the fourth when both the Mode_switch and
  65. Shift keys are used.

  66. keycode any = KEYSYMNAME ...
  67. If no existing key has the specified list of keysyms assigned
  68. to it, a spare key on the keyboard is selected and the keysyms
  69. are assigned to it. The list of keysyms may be specified in
  70. decimal, hex or octal.

  71. keysym KEYSYMNAME = KEYSYMNAME ...
  72. The KEYSYMNAME on the left hand side is translated into
  73. matching keycodes used to perform the corresponding set of
  74. keycode expressions. The list of keysym names may be found in
  75. the header file (without the XK_ prefix) or
  76. the keysym database /usr/share/X11/XKeysymDB. Note that if
  77. the same keysym is bound to multiple keys, the expression is
  78. executed for each matching keycode.

  79. clear MODIFIERNAME
  80. This removes all entries in the modifier map for the given
  81. modifier, where valid name are: Shift, Lock, Control, Mod1,
  82. Mod2, Mod3, Mod4, and Mod5 (case does not matter in modifier
  83. names, although it does matter for all other names). For
  84. example, ‘‘clear Lock’’ will remove all any keys that were
  85. bound to the shift lock modifier.

  86. add MODIFIERNAME = KEYSYMNAME ...
  87. This adds all keys containing the given keysyms to the
  88. indicated modifier map. The keysym names are evaluated after
  89. all input expressions are read to make it easy to write
  90. expressions to swap keys (see the EXAMPLES section).

  91. remove MODIFIERNAME = KEYSYMNAME ...
  92. This removes all keys containing the given keysyms from the
  93. indicated modifier map. Unlike add, the keysym names are
  94. evaluated as the line is read in. This allows you to remove
  95. keys from a modifier without having to worry about whether or
  96. not they have been reassigned.

  97. pointer = default
  98. This sets the pointer map back to its default settings (button
  99. 1 generates a code of 1, button 2 generates a 2, etc.).

  100. pointer = NUMBER ...
  101. This sets the pointer map to contain the indicated button
  102. codes. The list always starts with the first physical button.

  103. Lines that begin with an exclamation point (!) are taken as comments.

  104. If you want to change the binding of a modifier key, you must also
  105. remove it from the appropriate modifier map.


  106. EXAMPLES

  107. Many pointers are designed such that the first button is pressed using
  108. the index finger of the right hand. People who are left-handed
  109. frequently find that it is more comfortable to reverse the button codes
  110. that get generated so that the primary button is pressed using the
  111. index finger of the left hand. This could be done on a 3 button
  112. pointer as follows:

  113. % xmodmap -e "pointer = 3 2 1"

  114. Many applications support the notion of Meta keys (similar to Control
  115. keys except that Meta is held down instead of Control). However, some
  116. servers do not have a Meta keysym in the default keymap table, so one
  117. needs to be added by hand. The following command will attach Meta to
  118. the Multi-language key (sometimes labeled Compose Character). It also
  119. takes advantage of the fact that applications that need a Meta key
  120. simply need to get the keycode and don’t require the keysym to be in
  121. the first column of the keymap table. This means that applications
  122. that are looking for a Multi_key (including the default modifier map)
  123. won’t notice any change.

  124. % xmodmap -e "keysym Multi_key = Multi_key Meta_L"

  125. Similarly, some keyboards have an Alt key but no Meta key. In that
  126. case the following may be useful:

  127. % xmodmap -e "keysym Alt_L = Meta_L Alt_L"

  128. One of the more simple, yet convenient, uses of xmodmap is to set the
  129. keyboard’s "rubout" key to generate an alternate keysym. This
  130. frequently involves exchanging Backspace with Delete to be more
  131. comfortable to the user. If the ttyModes resource in xterm is set as
  132. well, all terminal emulator windows will use the same key for erasing
  133. characters:

  134. % xmodmap -e "keysym BackSpace = Delete"
  135. % echo "XTerm*ttyModes: erase ^?" | xrdb -merge

  136. Some keyboards do not automatically generate less than and greater than
  137. characters when the comma and period keys are shifted. This can be
  138. remedied with xmodmap by resetting the bindings for the comma and
  139. period with the following scripts:

  140. !
  141. ! make shift-, be < and shift-. be >
  142. !
  143. keysym comma = comma less
  144. keysym period = period greater

  145. One of the more irritating differences between keyboards is the
  146. location of the Control and Shift Lock keys. A common use of xmodmap
  147. is to swap these two keys as follows:

  148. !
  149. ! Swap Caps_Lock and Control_L
  150. !
  151. remove Lock = Caps_Lock
  152. remove Control = Control_L
  153. keysym Control_L = Caps_Lock
  154. keysym Caps_Lock = Control_L
  155. add Lock = Caps_Lock
  156. add Control = Control_L

  157. This example can be run again to swap the keys back to their previous
  158. assignments.

  159. The keycode command is useful for assigning the same keysym to multiple
  160. keycodes. Although unportable, it also makes it possible to write
  161. scripts that can reset the keyboard to a known state. The following
  162. script sets the backspace key to generate Delete (as shown above),
  163. flushes all existing caps lock bindings, makes the CapsLock key be a
  164. control key, make F5 generate Escape, and makes Break/Reset be a shift
  165. lock.

  166. !
  167. ! On the HP, the following keycodes have key caps as listed:
  168. !
  169. ! 101 Backspace
  170. ! 55 Caps
  171. ! 14 Ctrl
  172. ! 15 Break/Reset
  173. ! 86 Stop
  174. ! 89 F5
  175. !
  176. keycode 101 = Delete
  177. keycode 55 = Control_R
  178. clear Lock
  179. add Control = Control_R
  180. keycode 89 = Escape
  181. keycode 15 = Caps_Lock
  182. add Lock = Caps_Lock


  183. ENVIRONMENT

  184. DISPLAY to get default host and display number.


  185. SEE ALSO

  186. X(7), xev(1), Xlib documentation on key and pointer events


  187. BUGS

  188. Every time a keycode expression is evaluated, the server generates a
  189. MappingNotify event on every client. This can cause some thrashing.
  190. All of the changes should be batched together and done at once.
  191. Clients that receive keyboard input and ignore MappingNotify events
  192. will not notice any changes made to keyboard mappings.

  193. Xmodmap should generate "add" and "remove" expressions automatically
  194. whenever a keycode that is already bound to a modifier is changed.

  195. There should be a way to have the remove expression accept keycodes as
  196. well as keysyms for those times when you really mess up your mappings.


  197. AUTHOR

  198. Jim Fulton, MIT X Consortium, rewritten from an earlier version by
  199. David Rosenthal of Sun Microsystems.



阅读(3171) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~