私のキーボードには、移動時にパイプ文字になるバックスラッシュキーがあります。
Hyper
xorgで押しているときに修飾子にマッピングし、押したときのデフォルトの動作をマッピングしたいと思います。
私のコードに次のコードを追加しました.xinitrc
。
xmodmap -e "keycode 23 = Hyper_L"
xmodmap -e "keycode any = backslash"
xcape -e "Hyper_L=backslash"
次の例に従ってください。man xcape
長押しすると修飾子の役割を果たし、押すとバックスラッシュとして機能しますが、Shift が送信され続けた状態で押すとバックスラッシュが送信されます。なぜチューブを使用しないのですか?
xev
バックスラッシュを修飾子として使用して出力:
KeyPress event, serial 28, synthetic NO, window 0x1600001,
root 0x1a5, subw 0x0, time 50265029, (554,460), root:(1426,924),
state 0x0, keycode 51 (keysym 0xffed, Hyper_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 28, synthetic NO, window 0x1600001,
root 0x1a5, subw 0x0, time 50265325, (554,460), root:(1426,924),
state 0x40, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (61) "a"
XmbLookupString gives 1 bytes: (61) "a"
XFilterEvent returns: False
KeyRelease event, serial 28, synthetic NO, window 0x1600001,
root 0x1a5, subw 0x0, time 50265481, (554,460), root:(1426,924),
state 0x40, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (61) "a"
XFilterEvent returns: False
KeyRelease event, serial 28, synthetic NO, window 0x1600001,
root 0x1a5, subw 0x0, time 50265725, (554,460), root:(1426,924),
state 0x40, keycode 51 (keysym 0xffed, Hyper_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
xev
移動されていないキーの出力としてバックスラッシュ:
KeyPress event, serial 28, synthetic NO, window 0x2400001,
root 0x1a5, subw 0x0, time 50512478, (542,233), root:(1414,697),
state 0x0, keycode 51 (keysym 0xffed, Hyper_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 28, synthetic NO, window 0x2400001,
root 0x1a5, subw 0x0, time 50512598, (542,233), root:(1414,697),
state 0x40, keycode 51 (keysym 0xffed, Hyper_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
MappingNotify event, serial 28, synthetic NO, window 0x0,
request MappingKeyboard, first_keycode 8, count 248
KeyPress event, serial 28, synthetic NO, window 0x2400001,
root 0x1a5, subw 0x0, time 50512598, (542,233), root:(1414,697),
state 0x0, keycode 8 (keysym 0x5c, backslash), same_screen YES,
XLookupString gives 1 bytes: (5c) "\"
XmbLookupString gives 1 bytes: (5c) "\"
XFilterEvent returns: False
KeyRelease event, serial 28, synthetic NO, window 0x2400001,
root 0x1a5, subw 0x0, time 50512598, (542,233), root:(1414,697),
state 0x0, keycode 8 (keysym 0x5c, backslash), same_screen YES,
XLookupString gives 1 bytes: (5c) "\"
XFilterEvent returns: False
MappingNotify event, serial 29, synthetic NO, window 0x0,
request MappingKeyboard, first_keycode 8, count 248
xev
移動されたバックスラッシュ出力:
KeyPress event, serial 28, synthetic NO, window 0x1600001,
root 0x1a5, subw 0x0, time 50591657, (514,-58), root:(1386,406),
state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 28, synthetic NO, window 0x1600001,
root 0x1a5, subw 0x0, time 50591965, (514,-58), root:(1386,406),
state 0x1, keycode 51 (keysym 0xffed, Hyper_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 28, synthetic NO, window 0x1600001,
root 0x1a5, subw 0x0, time 50592077, (514,-58), root:(1386,406),
state 0x41, keycode 51 (keysym 0xffed, Hyper_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
MappingNotify event, serial 28, synthetic NO, window 0x0,
request MappingKeyboard, first_keycode 8, count 248
KeyPress event, serial 28, synthetic NO, window 0x1600001,
root 0x1a5, subw 0x0, time 50592077, (514,-58), root:(1386,406),
state 0x1, keycode 8 (keysym 0x5c, backslash), same_screen YES,
XLookupString gives 1 bytes: (5c) "\"
XmbLookupString gives 1 bytes: (5c) "\"
XFilterEvent returns: False
KeyRelease event, serial 28, synthetic NO, window 0x1600001,
root 0x1a5, subw 0x0, time 50592078, (514,-58), root:(1386,406),
state 0x1, keycode 8 (keysym 0x5c, backslash), same_screen YES,
XLookupString gives 1 bytes: (5c) "\"
XFilterEvent returns: False
MappingNotify event, serial 29, synthetic NO, window 0x0,
request MappingKeyboard, first_keycode 8, count 248
KeyRelease event, serial 29, synthetic NO, window 0x1600001,
root 0x1a5, subw 0x0, time 50592201, (514,-58), root:(1386,406),
state 0x1, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False