You are not logged in.

#1 2014-04-18 07:35:39

octref
Member
From: BK-201
Registered: 2014-04-18
Posts: 13

[SOLVED]Issue with remapping Caps_Lock using XKB

Hello guys, first post here :-)

I'm using i3 and remapped my Caps_Lock as Super_L, because I use Super+[Num] to switch between desktops and Super+Shift+[Num] to send app to different desktops.
The thing is, if I press Caps_Lock + Shift_L + 2, it won't work.
Caps_Lock + 1-9 works fine.
Caps_Lock + Shift_L + 1, Caps_Lock + Shift_L + 3-9 also works fine.
Caps_Lock + Shift_R + 1-9 works fine (weird)
Super+Shift of course works fine.
Just Caps_Lock + Shift_L + 2 doesn't work.

So I fired up xev, and noticed this.

// Pressing Caps_Lock and Shift_L
KeyPress event, serial 32, synthetic NO, window 0x1a00001,
    root 0x9f, subw 0x0, time 11947235, (-545,740), root:(417,742),
    state 0x10, keycode 66 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 32, synthetic NO, window 0x1a00001,
    root 0x9f, subw 0x0, time 11947883, (-545,740), root:(417,742),
    state 0x50, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

// Pressing 3, not releasing Caps_Lock and Shift_L
// This should be the correct output when I use Caps_Lock + Shift + [Num]
FocusOut event, serial 32, synthetic NO, window 0x1a00001,
    mode NotifyGrab, detail NotifyAncestor

// Release 3
FocusIn event, serial 32, synthetic NO, window 0x1a00001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 32, synthetic NO, window 0x0,
    keys:  0   0   0   0   0   0   4   0   4   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

// Pressing 2 while Caps_Lock and Shift are still being pressed
// Here is where it becomes weird. I'm holding down Caps_Lock and Shift_L and pressed 2 but it says Control_L
KeyPress event, serial 32, synthetic NO, window 0x1a00001,
    root 0x9f, subw 0x0, time 11952323, (-545,740), root:(417,742),
    state 0x51, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 32, synthetic NO, window 0x1a00001,
    root 0x9f, subw 0x0, time 11952323, (-545,740), root:(417,742),
    state 0x55, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

// Release 2

KeyRelease event, serial 32, synthetic NO, window 0x1a00001,
    root 0x9f, subw 0x0, time 11963339, (-545,740), root:(417,742),
    state 0x54, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 32, synthetic NO, window 0x1a00001,
    root 0x9f, subw 0x0, time 11963339, (-545,740), root:(417,742),
    state 0x50, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

// Release Caps_Lock and Shift_L

KeyRelease event, serial 32, synthetic NO, window 0x1a00001,
    root 0x9f, subw 0x0, time 11963339, (-545,740), root:(417,742),
    state 0x51, keycode 66 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 32, synthetic NO, window 0x1a00001,
    root 0x9f, subw 0x0, time 11963363, (-545,740), root:(417,742),
    state 0x11, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

As you see, if Caps and Shift are being pressed down and I press 2, it doesn't work as expected.

My i3 config ( I don't think anything is wrong here)

# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10

And then I followed the XKB wiki, did a

xkbcomp $DISPLAY output.xkb

Here are the relevent part:

// Under xkb_symbol
    key <CAPS> {         [         Super_L ] };

// Under xkb_types
    modifier_map Mod4 { <CAPS> };

// I think this might be the problem, but I really don't quite understand what this snippet says :-(
// Also under xkb_types
    type "SEPARATE_CAPS_AND_SHIFT_ALPHABETIC" {
        modifiers= Shift+Lock+LevelThree;
        map[Shift]= Level2;
        map[Lock]= Level4;
        preserve[Lock]= Lock;
        map[LevelThree]= Level3;
        map[Shift+LevelThree]= Level4;
        map[Lock+LevelThree]= Level3;
        preserve[Lock+LevelThree]= Lock;
        map[Shift+Lock+LevelThree]= Level3;
        level_name[Level1]= "Base";
        level_name[Level2]= "Shift";
        level_name[Level3]= "AltGr Base";
        level_name[Level4]= "Shift AltGr";
    };

It's really weird since Caps_Lock + Shift + 1, or 3, or 4, or any number other than 2 works fine. If there is a conflict between Caps and Shift, then all Caps_Lock + Shift + [Num] shouldn't work correctly.
Can someone help? Thanks a lot!

Last edited by octref (2014-04-18 08:54:56)


上善若水。

Offline

#2 2014-04-18 08:54:04

octref
Member
From: BK-201
Registered: 2014-04-18
Posts: 13

Re: [SOLVED]Issue with remapping Caps_Lock using XKB

Sorry guys, seems to be a problem of my keyboard.
I was using an external keyboard and the shortcut didn't work on it. I somehow forget to try the shortcut on my own laptop keyboard (Havent' used it for a long time).
Then I changed an external keyboard and it works well. It also works well on my laptop keyboard.


上善若水。

Offline

Board footer

Powered by FluxBB