xmodmap
code:.Xmodmap
!CapsLockキー
remove lock = Eisu_toggle
keycode 66 = Control_L
add control = Control_L
!無変換キー
keycode 102 = Mode_switch Mode_switch
keycode 26 = e E Escape Escape
keycode 31 = i I BackSpace BackSpace
keycode 43 = h H Left Left
keycode 44 = j J Down Down
keycode 45 = k K Up Up
keycode 46 = l L Right Right
!変換
keycode 100 = Shift_R Shift_R Return Return
add shift = Shift_R
!カタカナキー
keycode 101 = Control_R
add control = Control_R
をまとめる
そもそもxmodmapとは
xmodmap is a utility for modifying keymaps and pointer button mappings in Xorg.
xmodmap is not directly related to X keyboard extension (XKB), as it uses different (pre-XKB) ideas on how keycodes are processed within X. Generally, it is only recommended for the simplest tasks.
Xorgとは
X.Org Server(X.Org Foundation Open Source Public Implementation of X11)とは、X Window Systemの公式リファレンス実装である。オープンソースであり、かつフリーソフトウェアである。
X Windows Systemとは
ビットマップディスプレイ上でウィンドウシステムを提供する表示プロトコルである。
リファレンス実装とは
リファレンス実装(リファレンスじっそう、英: reference implementation)は、なんらかの機能を実現するハードウェアまたはソフトウェアであり、他者がそれを参考にして独自に実装することを助ける目的で作られたものを言う。参考実装(さんこうじっそう)とも呼ばれる。
Xorgには2種類のキーボード値がある
keycode
数値。kernelから受け取る。
keysym
keycodeに割り当てられた値。keycode 38はkeysym 0x61に割り当てられこれはASCII tabelでいうaになる。
Keymap table
xmodmap -pkeで見れる。
code: a
...
keycode 57 = n N
...
keycode = keysym
keysymは列ごとに意味がある。最大6列。key, shift+key, mode_switch+key, mode_switch+shift+key, iso_level3_shift+key,iso_level3_shift+shift+key
Custom tabel
$ xmodmap ~/.Xmodmapってやるとkey mapを読み込める
Activating the custom table
GDM, XDM, LightDMでは.Xmodmapをソースする必要はない。startxでは.xinitrcファイルを作る必要がある。
上のGDMとかはディスプレイマネージャのこと。詳しくはディスプレイマネージャ
うちのはGDMなのでソースする必要ない。
Modifier keys
xmodmap -pmでみれる。
それぞれのmodには4つまでしか登録できない。
Reassingnする
一回clearしないといけない。
Note: The example assumes that the Control_L and Control_R keysyms were assigned to the Control modifier, and Super_L and Super_R keysyms to the Mod4 modifier. If you get the following error message X Error of failed request: BadValue (integer parameter out of range for operation), you will need to adapt accordingly. Running xmodmap produces a list of modifiers and keys that are assigned to them.
BadValueのエラーは、clearすると言ってるけどそもそも割り当てられてないときに起こるらしい。