39aldo39/klfc

Only AltGr and Shift as modifiers triggering action.

Closed this issue · 6 comments

I'm new to xkb layouts, so my question may sound silly, but I having troubles understanding shift levels at all. As I get from docs, control and alt is supported modifiers. But if I edit those two lines in colemak layout from examples:

"shiftlevels": [ "None", "Shift", "Alt" ],

...

    { "pos": "J", "letters": [ "n", "N", "Left" ] },

then pressing Alt+n will trigger nothing. Same as if I added Control or Win to shiftlevels instead of Alt. The only modifier that triggers action is AltGr. Is that supposed behavior? Looking at examples I do see everywhere combinations of either Shift or AltGr and no other modifiers listed in docs, is this intentional? Or its smth wrong with my config that I get no action?

Your config looks right and you should get an action. I suspect that you get the actions Alt+Left (or Control+Left or Win+Left). This happens in Wayland, it should work fine in X. You can test this by executing xev in the terminal and pressing Alt+n. You should get the keysym Left with a state of 0x0. If Alt is still present, the state will be 0x8.

The Alt, Control and Win modifiers are kept, since the remapping may be used for changing shortcuts. For actions like Left they are removed. However, the method to do that is not (yet) supported in Wayland. I may add a way to indicate in the shiftlevels that you don't want Alt to be interpreted as shortcut modifier.

@39aldo39 Hmm, xev shows me status 0x8 but keysym is not Left, its n, so Left havent even parsed. Im not sure how you check for what your system is using, but htop shows me Xorg process and no Wayland occurences. Why does Left havent been parsed?

That's weird. A few more questions:

  • How have you activated the layout? Using the install scripts, or have you done something different?
  • Does it work if you use the shiftlevel [ "None", "AltGr", "Shift" ] (with Shift and AltGr swapped)?
  • I think you can check the system by executing echo $XDG_SESSION_TYPE. It should be x11 or wayland.

Yes, I installed layout, echo $XDG_SESSION_TYPE gives me nothing. I tried to take specifically those generated lines from symbols:

    key.type[Group1] = "NONE_SHIFT_ALT_ALPHABETIC";
    key <AC07> { [            k,            N,         Left ],
                 actions[Group1] = [ NoAction(), NoAction(), Redirect(key=<LEFT>,clearMods=Alt) ] };

and from types:

    type "NONE_SHIFT_ALT_ALPHABETIC" {
        modifiers = Alt+Shift+Lock;
        
        map[None] = Level1;
        map[Lock] = Level2;
        map[Shift] = Level2;
        map[Shift+Lock] = Level1;
        map[Alt] = Level3;
        map[Alt+Lock] = Level3;
        map[Alt+Shift] = Level3;
        map[Alt+Shift+Lock] = Level3;
        
        preserve[Alt] = Alt;
        preserve[Alt+Lock] = Alt;
        preserve[Alt+Shift] = Alt+Shift;
        preserve[Alt+Shift+Lock] = Alt;
        
        level_name[Level1] = "Base";
        level_name[Level2] = "Shift";
        level_name[Level3] = "Alt";
    };

In my own layout, which I enable via xkbcomp, and strangely, it works, but only Left
and base part, and Shift is triggering lowercase n. I tried to play a bit with generated part, include us layout into it, or declare it as partial, but had no result and my xorg process constantly crashes because of those experiments, and I already wrote my own layout (its wasnt easy, but I think I finally understood how all that xkb magic works). So I think I'll stop on this since that particular line works for me via inserting inside my layout, must be smth with my own system is wrong. Thanks for help.

I have found the problem. There was a bug in the install script, which stopped the installation. This caused the custom types (i.e. NONE_SHIFT_ALT_ALPHABETIC) to be not included. XKB fell back to the default type, which has AltGr instead of Alt.

Great, so it wasn't pointless). Sorry, I already deleted folder with my klfc json layout, and I also have no knowledge of haskell to be able to check master branch outside of archlinux yaourt installed package.