mapping backslash to modifier with xcape preserving pipe character
1
vote
0
answers
208
views
My keyboard has a backslash key which when shifted is a pipe character.
I want to map it in xorg to a
Hyper
modifier when held, and its default behaviour when pressed.
I have added the following code to my .xinitrc
:
xmodmap -e "keycode 23 = Hyper_L"
xmodmap -e "keycode any = backslash"
xcape -e "Hyper_L=backslash"
following the example in man xcape
It acts as a modifier while held, and backslash when pressed, but when pressed with shift held, a backslash is still sent! Why not a pipe?
xev
output for backslash as a modifier:
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
output for backslash as a unshifted key:
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
output for shifted backslash:
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
Asked by jameh
(261 rep)
Feb 8, 2020, 06:57 AM