• You are not logged in.

    xkb tarmak mappings ALT key not working

    • Started by bph
    • 15 Replies:
    • Reputation: 11
    • Registered: 06-Jun-2013
    • Posts: 551

    i'm working my way through the tarmak phases, adding new sections to:

    /usr/share/X11/xkb/symbols/gb
    /usr/share/X11/xkb/rules/evdev.lst
    /usr/share/X11/xkb/rules/ecdec.xml

    as i go

    everything is fine, except i can't get the ALT modifier to work with the new keys - its coming out as the old qwerty mappings

    this is causing mayhem with shortcuts in emacs - its pretty much unusable so i need to find a fix

    i also noticed that CTRL-ALT isn't working either with the same issue - this one isn't so crucial but would be nice to have

    hopefully its a one-line fix to the gb file in the tarmak definition - anyone one have any ideas

    Offline
    • 0
    • Reputation: 211
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,345

    This sounds like a problem someone else had with a US layout. Unless you have any ALT key mappings in the actual Tarmak layout it shouldn't cause a problem for you – if you've defined it right. Check your includes if you have any!

    Did you see how I did this in my xkb files (see my topic sig)? Notably the symbols/colemak and symbols/us files – search for 'tarmak' there. I modularized the layouts but you don't really have to do that. More importantly, you start by including one layout and then you can redefine only what you have to which in the case of Tarmak isn't many keys. (It'll give some complaints about multiple definitions if you watch the setxkbmap output, but it'll work!) If you don't mind lv3-4 mappings then just copy/paste my solution into the uk symbols file and update the rules files accordingly!

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 11
    • Registered: 06-Jun-2013
    • Posts: 551

    hi dreymar

    i have actually applied your patch on one of my machines - need to check whether that exhibits the same problem

    on this machine i have my own tarmak patches and the alt key definitely doesn't work

    i had a look through your patch earlier but can't identify anything specifically different that looks like it would fix the problem

    what do you mean when you say check your includes?

    my 'gb' patch looks like this:

    partial default alphanumeric_keys
    xkb_symbols "tarmak-2" {

        // Describes the differences between a basic UK keyboard layout and
        // Tarmak-2

        include "gb(basic)"

        name[Group1]="English (UK, Tarmak-1)";

        // E->F
        //key <AD03>    { [         e,          E,            e,            E ]    };   
        key <AD03>    { [         f,          F,      dstroke,  ordfeminine ]    };   

        // T->G
        //key <AD05>    { [         t,          T,       tslash,       Tslash ]    };
        key <AD05>    { [         g,          G,          eng,          ENG ]    };

        //F->T
        //key <AC04>    { [         f,          F,      dstroke,  ordfeminine ]    };
        key <AC04>    { [         t,          T,       tslash,       Tslash ]    };

        //G->J
        //key <AC05>    { [         g,          G,          eng,          ENG ]    };
        key <AC05>    { [         j,          J,    dead_hook,    dead_horn ] };   
       
        // J->N
        //key <AC07> { [       j,          J,             j,                J ] };
        key <AC07>    { [         n,          N,            n,            N ]    };   

        // K->E
        //key <AC08> { [       k,          K,            oe,               OE ] };
        key <AC08>    { [         e,          E,            e,            E ]    };

        // N->K
        //key <AB06>    { [         n,          N,            n,            N ]    };
        key <AB06>    { [         k,          K,          kra,    ampersand ]    };

        include "level3(ralt_switch_multikey)"
    };

    i don't think the mods i made to evdev.xml and evdev.lst are relevant - i haven't modified any other files

    Offline
    • 0
    • Reputation: 211
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,345

    You include gb(basic) and then level3(ralt_switch_multikey) which was already included in gb(basic). That's probably what messes up your Alt key for you (although it shouldn't do anything to the LAlt...)? RAlt plus Ctrl equals AltGr which is used as a switch to type lv3-4 symbols (like 'eng/ENG' on 'g/G').

    If you don't want this functionality, you can't include gb(basic) directly but have to include "latin" and change the few symbol mappings in gb(basic) in your own layout. Sorry, but the layouts tend to mess with modifier settings which they arguably shouldn't do directly but on a higher level like my modular layouts do. The lv3 switch is very basic though, as just about any layout with lv3-4 mappings tends to use the RAlt key as an AltGr.

    Keep in mind that on most Linux systems you can set the behavior of modifier keys in Options as well! So check your keyboard options for any interesting settings that may affect your Alt keys. Try a 'setxkbmap -v 9' to see what your active configuration is.

    One little typo in your script: '    name[Group1]="English (UK, Tarmak-1)";' – 'Tarmak-1' should've been 'Tarmak-2'.

    Tip: Using [] tags with 'code' and '/code' in your forum posts helps readability. ;)

    Last edited by DreymaR (26-Jun-2013 14:17:43)

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 11
    • Registered: 06-Jun-2013
    • Posts: 551

    good spots but the offending lines haven't made any difference

    i think i need to check whether your patch works

    i'll check that later on at home

    am i right in thinking that logging out and back in should refresh all the xkb stuff

    as an aside any idea how to 'reinstall' xkb defaults for 13.04 - im in a situation with your patch where it fails because i've made my own mods - can't face fixing it manually

    Offline
    • 0
    • Reputation: 211
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,345

    Logging out and back is necessary but not sufficient (unless you know how to restart the xkb server manually) as it doesn't refresh anything if there's already a server file present. My instdiff script therefore clears out the old temporary server files in /var/lib/xkb/server*.xkm which you should do too.

    My patch script works from an unmodified XKB install. If you've made changes to files you'll have to merge patches manually. Reinstalling xkb defaults is as simple as putting back the backups for the files you messed with. You *did* back up those files, right? ;)

    Actually, if you look in my "modified files" download for Ub13.04 the original files are there – only the ones I've made changes to but those include the ones you changed.

    If the "offending lines" haven't made any difference then your problem shouldn't be about Tarmak at all. My prediction is that the default UK layout will exhibit the same behavior for you and the problem sits in one of the Options settings. Try the verbose setxkbmap I mentioned above.

    Last edited by DreymaR (26-Jun-2013 14:29:17)

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 211
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,345

    Hang on – you've made your layout the default? It says "partial default" etc. I wouldn't do that as the 'basic' layout should remain the default. If you insist on defaulting your own layout then it needs to be the first entry in the file and other layouts will refer to it.

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 11
    • Registered: 06-Jun-2013
    • Posts: 551

    great - i'll take a look later and hopefully get it fixed

    Offline
    • 0
    • Reputation: 11
    • Registered: 06-Jun-2013
    • Posts: 551

    curiouser and curiouser

    i'm writing this on my machine at home

    this is the one i installed dreymar's patch on a clean 13.04 install

    and guess what

    the alt modifier doesn't work here either

    for example, goto line, M-g-g, I have to hit M-j-j under tarmak-2, i.e. the old qwerty mapping

    could it be an emacs issue?

    is there a means to test what is happening with the various key combinations say from a term window?

    i have tested the following keyboard layouts and they all exhibit the same problem

    English(Tarmak-1_E-Colemak transitional)
    English(Tarmak-2_ET-Colemak transitional)
    English(Colemak)
    English(Colemak[eD])
    English(UK,Colemak)

    the only other thing i've done is swap caps lock and ctrl via ubuntu keyboard settings

    this is a bit of a show stopper for me unfortunately

    Last edited by bph (27-Jun-2013 20:05:00)
    Offline
    • 0
    • Reputation: 0
    • Registered: 04-Apr-2013
    • Posts: 538
    bph said:

    is there a means to test what is happening with the various key combinations say from a term window?

    xev

    bph said:

    the only other thing i've done is swap caps lock and ctrl via ubuntu keyboard settings

    I can't remember if this caused any side-effects (back before I started swapping via evdev, due to wanting caps -> esc -> ctrl -> caps).

    I wish I could help more, but when it comes to xkb, I'm little more than an amateur hack. (The messy hack solution, by the way, would be to, starting from scratch, simply edit a preexisting qwerty layout in /usr/share/X11/xkb/symbols/us, everytime you wanted to switch tarmaks.  It's only 4-5 keys at a time, and it's not like you'll go back to the previous tarmak.  Terrible and lazy solution, I know..)

    Last edited by lalop (27-Jun-2013 23:35:58)
    Offline
    • 0
    • Reputation: 11
    • Registered: 06-Jun-2013
    • Posts: 551

    hi lalop

    editing a pre existing qwerty layout is effectively what i have done on one machine, on the other i installed dreymars patch

    neither of them work correctly with the alt modifier

    its as though when alt is pressed the whole keyboard reverts to qwerty layout

    i'm absolutely stumped...

    Offline
    • 0
    • Reputation: 11
    • Registered: 06-Jun-2013
    • Posts: 551

    heres what xev is telling me (for tarmak-2):

    press left alt (M):

    KeyPress event, serial 41, synthetic NO, window 0x3a00001,
        root 0xa5, subw 0x0, time 2182112, (84,-58), root:(1537,457),
        state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
        XLookupString gives 0 bytes: 
        XmbLookupString gives 0 bytes: 
        XFilterEvent returns: False
    
    KeyRelease event, serial 41, synthetic NO, window 0x3a00001,
        root 0xa5, subw 0x0, time 2182472, (84,-58), root:(1537,457),
        state 0x4018, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
        XLookupString gives 0 bytes: 
        XFilterEvent returns: False

    press j (qwerty g):

    KeyPress event, serial 41, synthetic NO, window 0x3a00001,
        root 0xa5, subw 0x0, time 2544853, (106,-13), root:(1559,502),
        state 0x4010, keycode 42 (keysym 0x6a, j), same_screen YES,
        XKeysymToKeycode returns keycode: 44
        XLookupString gives 1 bytes: (6a) "j"
        XmbLookupString gives 1 bytes: (6a) "j"
        XFilterEvent returns: False
    
    KeyRelease event, serial 41, synthetic NO, window 0x3a00001,
        root 0xa5, subw 0x0, time 2545013, (106,-13), root:(1559,502),
        state 0x4010, keycode 42 (keysym 0x6a, j), same_screen YES,
        XKeysymToKeycode returns keycode: 44
        XLookupString gives 1 bytes: (6a) "j"
        XFilterEvent returns: False

    press g (qwerty t):

    KeyPress event, serial 41, synthetic NO, window 0x3a00001,
        root 0xa5, subw 0x0, time 2224592, (0,-82), root:(1453,433),
        state 0x4010, keycode 28 (keysym 0x67, g), same_screen YES,
        XKeysymToKeycode returns keycode: 42
        XLookupString gives 1 bytes: (67) "g"
        XmbLookupString gives 1 bytes: (67) "g"
        XFilterEvent returns: False
    
    KeyRelease event, serial 41, synthetic NO, window 0x3a00001,
        root 0xa5, subw 0x0, time 2224872, (0,-82), root:(1453,433),
        state 0x4010, keycode 28 (keysym 0x67, g), same_screen YES,
        XKeysymToKeycode returns keycode: 42
        XLookupString gives 1 bytes: (67) "g"
        XFilterEvent returns: False

    press M-g (qwerty M-t):

    KeyPress event, serial 41, synthetic NO, window 0x3a00001,
        root 0xa5, subw 0x0, time 2038881, (85,-172), root:(1538,343),
        state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
        XLookupString gives 0 bytes: 
        XmbLookupString gives 0 bytes: 
        XFilterEvent returns: False
    
    FocusOut event, serial 41, synthetic NO, window 0x3a00001,
        mode NotifyGrab, detail NotifyAncestor
    
    FocusIn event, serial 41, synthetic NO, window 0x3a00001,
        mode NotifyUngrab, detail NotifyAncestor
    
    KeymapNotify event, serial 41, synthetic NO, window 0x0,
        keys:  4294967212 0   0   16  0   0   0   0   1   0   0   0   0   0   0   0   
               0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
    
    KeyPress event, serial 41, synthetic NO, window 0x3a00001,
        root 0xa5, subw 0x0, time 2039121, (85,-172), root:(1538,343),
        state 0x18, keycode 28 (keysym 0x74, t), same_screen YES,
        XLookupString gives 1 bytes: (74) "t"
        XmbLookupString gives 1 bytes: (74) "t"
        XFilterEvent returns: False
    
    KeyRelease event, serial 41, synthetic NO, window 0x3a00001,
        root 0xa5, subw 0x0, time 2039337, (85,-172), root:(1538,343),
        state 0x4018, keycode 28 (keysym 0x67, g), same_screen YES,
        XKeysymToKeycode returns keycode: 42
        XLookupString gives 1 bytes: (67) "g"
        XFilterEvent returns: False
    
    KeyRelease event, serial 41, synthetic NO, window 0x3a00001,
        root 0xa5, subw 0x0, time 2039673, (85,-172), root:(1538,343),
        state 0x4018, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
        XLookupString gives 0 bytes: 
        XFilterEvent returns: False

    note the weirdness going on with the keypress and keyrelease for 'g' (in the M-g) being different; on press it is 't' and on release it is 'g' - could this be the root of the problem?

    I notice also that:

    XKeysymToKeycode returns keycode: 42

    is missing from the 'g' key press for 'M-g' as opposed to the xev output for just pressing 'g'

    This would tally with the behaviour in emacs, i.e. M-g-g is doing a double 'transpose' rather than 'goto-line', i.e emacs is executing M-t twice

    Last edited by bph (28-Jun-2013 11:27:03)
    Offline
    • 0
    • Reputation: 0
    • Registered: 04-Apr-2013
    • Posts: 538

    If Alt fails for modified qwerty layout, then it must be defaulting to your base qwerty layout in general.  So, as a final solution, we know that modifying the base qwerty layout will work.

    There are more conservative ways of trying to get it to stop noticing the base qwerty layout, though.  If you haven't yet tried putting the tarmak layout as the topmost layout on the layout switcher list (which matters on at least gnome, for some reason), do so.  If that fails, you can try removing the base qwerty layout from the layout switcher list entirely (risky for obvious reasons).



    Alt-g:

    VisibilityNotify event, serial 38, synthetic NO, window 0x3c00001,
        state VisibilityUnobscured
    
    Expose event, serial 38, synthetic NO, window 0x3c00001,
        (0,0), width 178, height 10, count 3
    
    Expose event, serial 38, synthetic NO, window 0x3c00001,
        (0,10), width 10, height 58, count 2
    
    Expose event, serial 38, synthetic NO, window 0x3c00001,
        (68,10), width 110, height 58, count 1
    
    Expose event, serial 38, synthetic NO, window 0x3c00001,
        (0,68), width 178, height 110, count 0
    
    FocusIn event, serial 38, synthetic NO, window 0x3c00001,
        mode NotifyWhileGrabbed, detail NotifyNonlinear
    
    KeymapNotify event, serial 38, synthetic NO, window 0x0,
        keys:  68  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
               0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
    
    FocusIn event, serial 38, synthetic NO, window 0x3c00001,
        mode NotifyUngrab, detail NotifyAncestor
    
    KeymapNotify event, serial 38, synthetic NO, window 0x0,
        keys:  3   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
               0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
    
    KeyPress event, serial 38, synthetic NO, window 0x3c00001,
        root 0xa1, subw 0x0, time 46253754, (414,57), root:(425,382),
        state 0x0, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
        XLookupString gives 0 bytes: 
        XmbLookupString gives 0 bytes: 
        XFilterEvent returns: False
    
    KeyPress event, serial 38, synthetic NO, window 0x3c00001,
        root 0xa1, subw 0x0, time 46254170, (414,57), root:(425,382),
        state 0x8, keycode 28 (keysym 0x67, g), same_screen YES,
        XLookupString gives 1 bytes: (67) "g"
        XmbLookupString gives 1 bytes: (67) "g"
        XFilterEvent returns: False
    
    KeyRelease event, serial 38, synthetic NO, window 0x3c00001,
        root 0xa1, subw 0x0, time 46254324, (414,57), root:(425,382),
        state 0x8, keycode 28 (keysym 0x67, g), same_screen YES,
        XLookupString gives 1 bytes: (67) "g"
        XFilterEvent returns: False
    
    KeyRelease event, serial 38, synthetic NO, window 0x3c00001,
        root 0xa1, subw 0x0, time 46254442, (414,57), root:(425,382),
        state 0x8, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
        XLookupString gives 0 bytes: 
        XFilterEvent returns: False
    Last edited by lalop (28-Jun-2013 12:19:41)
    Offline
    • 0
    • Reputation: 211
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,345

    Like lalop (and I) said a couple of times, you need to check if this is a Colemak or general issue (sure seems like the latter by now)! Check the preinstalled Dvorak layout for instance.

    And yeah, make sure the layout you test is the first one in the list. Some silly programs can't get it right otherwise.

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 11
    • Registered: 06-Jun-2013
    • Posts: 551
    lalop said:

    If you haven't yet tried putting the tarmak layout as the topmost layout on the layout switcher list (which matters on at least gnome, for some reason), do so.

    lalop you are a genius!

    problem fixed with no fiddling around in the guts of xkb...

    note xev output for M-g now looks like this:

    KeyPress event, serial 41, synthetic NO, window 0x4400001,
        root 0xa5, subw 0x0, time 12210315, (-157,-11), root:(1296,504),
        state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
        XLookupString gives 0 bytes: 
        XmbLookupString gives 0 bytes: 
        XFilterEvent returns: False
    
    FocusOut event, serial 41, synthetic NO, window 0x4400001,
        mode NotifyGrab, detail NotifyAncestor
    
    FocusIn event, serial 41, synthetic NO, window 0x4400001,
        mode NotifyUngrab, detail NotifyAncestor
    
    KeymapNotify event, serial 41, synthetic NO, window 0x0,
        keys:  0   0   0   16  0   0   0   0   1   0   0   0   0   0   0   0   
               0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
    
    KeyPress event, serial 41, synthetic NO, window 0x4400001,
        root 0xa5, subw 0x0, time 12210435, (-157,-11), root:(1296,504),
        state 0x18, keycode 28 (keysym 0x67, g), same_screen YES,
        XLookupString gives 1 bytes: (67) "g"
        XmbLookupString gives 1 bytes: (67) "g"
        XFilterEvent returns: False
    
    KeyRelease event, serial 41, synthetic NO, window 0x4400001,
        root 0xa5, subw 0x0, time 12210595, (-157,-11), root:(1296,504),
        state 0x4018, keycode 28 (keysym 0x74, t), same_screen YES,
        XKeysymToKeycode returns keycode: 41
        XLookupString gives 1 bytes: (74) "t"
        XFilterEvent returns: False
    
    KeyRelease event, serial 41, synthetic NO, window 0x4400001,
        root 0xa5, subw 0x0, time 12210787, (-157,-11), root:(1296,504),
        state 0x4018, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
        XLookupString gives 0 bytes: 
        XFilterEvent returns: False

    the press and release values for 'g' are reversed! but that fixes the problem

    its a bit counter intuitive to think that the order of your keyboard layouts in the gnome dialog matters - but there it is...

    tarmak transition can resume!

    Offline
    • 0
    • Reputation: 211
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,345

    Yeah, sorry I forgot to mention that. It's a known bug, not only affecting Colemakers – but it doesn't seem to get fixed...

    I've added a mention of this problem in my Big Bag topic.

    Last edited by DreymaR (28-Jun-2013 13:04:30)

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0