3

I'm trying to simulate numeric keypad keys on the main keyboard but am struggling with xkb.

How do I to convert a <LWIN> + <AD07> into a 'Left'? (AKA Super + u)

It needs to play nice with Shift, Ctrl (and ideally Alt too).

The closest I came was:

    type "wkafk1" {
        modifiers = Shift+Super;
        map[Shift]= Level2;
        map[Super] = Level3;
        level_name[Level1] = "Base";
        level_name[Level2] = "Shift"; 
        level_name[Level3] = "Fn"; 
    };

...
    key <AD07> {
        type= "wkafk1",
        symbols[Group1]= [               u,               U, Left ]
    };

But Shift+Super+u isn't handled.

This one was close too:

    type "wkafk1" {
        modifiers = Shift+Super;
        map[Shift]= Level2;
        map[Super] = Level3;
        map[Shift+Super]=Level4;
        level_name[Level1] = "Base";
        level_name[Level2] = "Shift"; 
        level_name[Level3] = "Fn"; 
        level_name[Level4] = "Fn Shift";
    };
...
    key <AD07> {
        type= "wkafk1",
        symbols[Group1]= [               u,               U, Left, Shift+Left ]
    };

But it didn't compile because I don't know how to emit a modified symbol (Shift+Left is not allowed).

Do I need an 'interpret' statetment with action= RedirectKey(...) ?

1 Answer 1

4

Thanks to some prior art, here are the steps:

  1. Create a copy of current config:
xkbcomp $DISPLAY custom.xkb
  1. Edit the resulting custom.xkb.
  2. Find the end of section: xkb_types and add this:
     type "wkafk1" {
        modifiers = Shift+Super;
        map[Shift] = level2;
        map[Super] = level3;
        map[Super+Shift] = level3;
        level_name[Level1] = "Base";
        level_name[Level2] = "Caps";
        level_name[Level3] = "Arrows";
     };
  1. Replace key definition <AD07> in section: xkb_symbols with this:
     key <AD07> {
         type= "wkafk1",
         symbols[Group1]= [ u, U, NoSymbol],
         actions[Group1]=[ NoAction(), NoAction(), RedirectKey(key=<LEFT>,clearmods=Super)]
     };
  1. Compile and use customized config:
xkbcomp custom.xkb $DISPLAY

Note that this works with Shift and Ctrl key combinations.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .