alols / xcape

Linux utility to configure modifier keys to act as other keys when pressed and released on their own.
GNU General Public License v3.0
2.1k stars 117 forks source link

Shift_L=parenleft;Shift_R=parenright generates '9' and '0', not '(' and ')' #52

Closed jashank closed 7 years ago

jashank commented 9 years ago

I've seen this bug a few times; it seems to be system-specific.

On my laptop, I'm running server 1.17.2-2 and libX11 1.6.3-1 on Arch Linux; this configuration works. On my desktop, I'm running server 1.14.7_5,1 and libX11 1.6.2_3,1 on FreeBSD 10.2-BETA2, and get this.

Here's xcape generating Shift_L => '9':

KeyPress event, serial 29, synthetic NO, window 0x2400001,
    root 0x2bd, subw 0x0, time 77669581, (-449,135), root:(1702,575),
    state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 32, synthetic NO, window 0x2400001,
    root 0x2bd, subw 0x0, time 77669633, (-449,135), root:(1702,575),
    state 0x1, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

MappingNotify event, serial 32, synthetic NO, window 0x0,
    request MappingKeyboard, first_keycode 8, count 248

KeyPress event, serial 32, synthetic NO, window 0x2400001,
    root 0x2bd, subw 0x0, time 77669633, (-449,135), root:(1702,575),
    state 0x0, keycode 18 (keysym 0x39, 9), same_screen YES,
    XLookupString gives 1 bytes: (39) "9"
    XmbLookupString gives 1 bytes: (39) "9"
    XFilterEvent returns: False

KeyRelease event, serial 32, synthetic NO, window 0x2400001,
    root 0x2bd, subw 0x0, time 77669633, (-449,135), root:(1702,575),
    state 0x0, keycode 18 (keysym 0x39, 9), same_screen YES,
    XLookupString gives 1 bytes: (39) "9"
    XFilterEvent returns: False

and here's Shift + 9 => '(':


KeyPress event, serial 34, synthetic NO, window 0x2400001,
    root 0x2bd, subw 0x0, time 77725149, (-449,135), root:(1702,575),
    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 34, synthetic NO, window 0x2400001,
    root 0x2bd, subw 0x0, time 77725397, (-449,135), root:(1702,575),
    state 0x1, keycode 18 (keysym 0x28, parenleft), same_screen YES,
    XLookupString gives 1 bytes: (28) "("
    XmbLookupString gives 1 bytes: (28) "("
    XFilterEvent returns: False

KeyRelease event, serial 34, synthetic NO, window 0x2400001,
    root 0x2bd, subw 0x0, time 77725473, (-449,135), root:(1702,575),
    state 0x1, keycode 18 (keysym 0x28, parenleft), same_screen YES,
    XLookupString gives 1 bytes: (28) "("
    XFilterEvent returns: False

KeyRelease event, serial 34, synthetic NO, window 0x2400001,
    root 0x2bd, subw 0x0, time 77725597, (-449,135), root:(1702,575),
    state 0x1, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

If I give the mapping as Shift_L=0x28;Shift_R=0x29, I get the same results.

I'm stumped.

Froziph commented 8 years ago

I realise this post is a year old, but hey, maybe you still want this or someone else can use it in the future.

This solution works for me:

xcape -e Shift_L='Shift_L|9'
xcape -e Shift_R='Shift_R|0'