You are not logged in.

#1 2019-04-22 02:11:21

e-max
Member
Registered: 2006-11-27
Posts: 16

Using R_Alt as a Level3

Hi guys!
I would like to have some way to enter frequently used in symbols (like {}()[], )  pressing alfanumeric keys with a modificator key (R_Alt).
So, for example, pressing R_Alt+F would give me "}".
I tried to achieve it following this wiki article - https://wiki.archlinux.org/index.php/X_ … ion#Level3
It describes something very similar.
What I did is update xkb_symbols section with

    key <RALT> {
        [         ISO_Level3_Shift]
    };

    key <AC03> {
        type= "THREE_LEVEL",
        symbols[Group1]= [ d, D, braceleft ],
        symbols[Group2]= [     Cyrillic_ve,     Cyrillic_VE,       braceleft]
    };
    key <AC04> {
        type= "THREE_LEVEL",
        symbols[Group1]= [               f,               F,             braceright ],
        symbols[Group2]= [      Cyrillic_a,      Cyrillic_A,             braceright ]
    };

my xkb_compatibility looks like

    virtual_modifiers NumLock,Alt,LevelThree,LAlt,RAlt,RControl,LControl,ScrollLock,LevelFive,AltGr,Meta,Super,Hyper;


    interpret ISO_Level3_Shift+AnyOf(all) {
        virtualModifier= LevelThree;
        useModMapMods=level1;
        action= SetMods(modifiers=LevelThree,clearLocks);
    };

    interpret ISO_Level3_Shift+AnyOfOrNone(all) {
        action= SetMods(modifiers=LevelThree,clearLocks);
    };

and it almost works.  Testing it with xev I can see

KeyPress event, serial 28, synthetic NO, window 0x4000001,
    root 0x16a, subw 0x0, time 97244170, (266,499), root:(1550,556),
    state 0x10, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
    XKeysymToKeycode returns keycode: 92
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 28, synthetic NO, window 0x4000001,
    root 0x16a, subw 0x0, time 97244712, (266,499), root:(1550,556),
    state 0x98, keycode 41 (keysym 0x7d, braceright), same_screen YES,
    XKeysymToKeycode returns keycode: 35
    XLookupString gives 1 bytes: (7d) "}"
    XmbLookupString gives 1 bytes: (7d) "}"
    XFilterEvent returns: False

However, trying it in a console I get weird things.

$ cat -
^[}

When I press Ctrl-V R_Alt-F  I get <M-}>

Is it the problem mentioned in the wiki?
"As you may find out using xev, this produces Mod5+Left instead of just Left. But that is ok as most applications ignore state bits they do not use. "

Is it possible to get rid of modifier in the beginning?

Offline

#2 2019-04-22 06:22:59

seth
Member
Registered: 2012-09-03
Posts: 50,008

Re: Using R_Alt as a Level3

include "level3(ralt_switch)"

?
There're btw. quite some russian(?) variants and the phonetic ones (rulemak/azerty - don't ask me) seem to map braces, maybe look around in /usr/share/X11/xkb/symbols/ru whether anything there already matches your desires?

Offline

#3 2019-04-23 10:45:58

e-max
Member
Registered: 2006-11-27
Posts: 16

Re: Using R_Alt as a Level3

Hi Seth!
Thank you for your answer!  Digging in it right now.
Xkb is a quite confusing piece of software - I was a wise person,  avoiding dealing with it during all the years I use Linux.
I'll return back if/when I'll give up.

Offline

Board footer

Powered by FluxBB