xcape를 사용하여 파이프 문자를 보존하고 백슬래시를 수정자에 매핑

xcape를 사용하여 파이프 문자를 보존하고 백슬래시를 수정자에 매핑

내 키보드에는 이동할 때 파이프 문자가 되는 백슬래시 키가 있습니다.

Hyperxorg에서 누르고 있을 때 수정자 에 매핑하고, 누를 때의 기본 동작을 매핑하고 싶습니다 .

내 코드에 다음 코드를 추가했습니다 .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

관련 정보