• You are not logged in.

    Thumb key proposal for Shift and AltGr on standard keyboards

    • Started by stevep99
    • 10 Replies:
    • Reputation: 16
    • From: UK
    • Registered: 14-Apr-2014
    • Posts: 402

    This idea is for those with standard keyboards, with a non-split spacebar.

    (I was thinking about this because I was using my laptop lately, and miss having access to the extra shift key which is defined by the left-half of my split space-bar!)

    This idea is designed for people that:
    - are already using AltGr (e.g. for accented characters or a custom symbols layer)
    - want a way to access Shift using only thumb keys.

    So let's cut to the chase. The idea is to provide a new layer on the AltGr+Space combo. This is easy to do as you would simply use both thumbs, leaving your other eight fingers free to reach the main body of keys, without moving your hands away from the home position.

    Example mapping #1:
    - AltGr would be unchanged, providing access to accents/symbols, the usual layer 3.
    - AltGr+space would be mapped to Shift. Thus, to do a capital T, you would do AltGr+Space+T.

    Example mapping #2:
    - AltGr would be mapped to Shift.
    - AltGr+space would be mapped to the usual AltGr function.

    I am currently experimenting with mapping #1, but perhaps if you use Shift more than AltGr, mapping #2 might make more sense.

    Although the extra layer requires three keys instead of two, because they are both thumbs, it's actually pretty effortless.

    While this solution is not as good as having a split space bar, I think it's a potentially elegant solution to providing more thumb layers without having to move lots of modifiers around.

    Last edited by stevep99 (13-Mar-2017 15:20:20)

    Using Colemak Mod-DH with some additional ergonomic keyboard mods.

    Offline
    • 0
    • Reputation: 23
    • From: Bærum, Norway
    • Registered: 13-Dec-2006
    • Posts: 3,717

    That is a cool idea! And it's entirely doable in XKB.

    If you try it out, let us know how smooth it feels in actual use!

    Last edited by DreymaR (14-Mar-2017 16:08:25)
    Online
    • 0
    • Reputation: 16
    • From: UK
    • Registered: 14-Apr-2014
    • Posts: 402
    DreymaR said:

    That is a cool idea! And it's entirely doable in XKB.

    If you try it out, let us know how smooth it feels in actual use!

    Actually, I am having a bit trouble implementing it in XKB. I am try to achieve :

    - AltGr mapped to Shift.
    - AltGr+space mapped to the usual AltGr function.

    I have mapped AltGr to Shift OK. Now, to make AltGr+space produce normal AltGr, I have set the following:

        key <SPCE> { symbols[Group1]=[ NoSymbol , NoSymbol , Return , Return ,
                       Return               , Return                , // Enter
                       nobreakspace         , nobreakspace         ], // Space
                     actions[Group1]=[NoAction(),SetMods(mods=Mod5),NoAction(),NoAction(),
                       Redirect(key=<RTRN>) , Redirect(key=<RTRN>)  , // <RTRN>
                       NoAction()           , NoAction()           ]
                   };  // <SPCE>

    Note the SetMods(mods=Mod5) entry. The almost works. What happens is, pressing AltGr+Space gives me AltGr+Shift, rather than just AltGr. In other words, I need to somehow cancel the Shift activation.

    Any advice from you XKB experts?

    Last edited by stevep99 (Yesterday 10:32:56)

    Using Colemak Mod-DH with some additional ergonomic keyboard mods.

    Offline
    • 0
    • Reputation: 23
    • From: Bærum, Norway
    • Registered: 13-Dec-2006
    • Posts: 3,717

    Do you want Lv3+Space and Lv3+Shift+Space to be Return? Maybe you'll have to declare that by explicit actions; sometimes that's necessary. Otherwise, you have two wrongly placed key mappings on lv3-4.

    Let's see: You've mapped level2 of Space to Mod5. That _should_ make AltGr(=Shift)+Space turn that mod on. Mapping the mod state explicitly like that is what I'm used to. However, for completeness and robustness I'd also map the key name (in this case, ISO_Level3_Shift) and not only the action alone.

    You can clear mods with the clearmods argument; I've used that extensively in my Extend mappings. I hope it works with the SetMods() action...?

    Try this:

       key <SPCE> { symbols[Group1]=[ NoSymbol , ISO_Level3_Shift , NoSymbol , NoSymbol ,
                       Return               , Return                , // Enter
                       space                , nobreakspace         ], // Space
                     actions[Group1]=[NoAction(),SetMods(mods=Mod5,clearmods=Shift),NoAction(),SetMods(mods=Shift),
                       Redirect(key=<RTRN>) , Redirect(key=<RTRN>)  , // <RTRN>
                       NoAction()           , NoAction()           ]
                   };  // <SPCE>

    That should make AltGr(=Shift)+Space into Mod5/Lv3_shift. But have you considered how you wanted to get Mod5+Shift to activate lv4? Unless you have a good answer to that, maybe your example #1 is the best one after all? In my AltGr mappings at least, there are many letters with a capital version such as Ʒʒ, Þþ, Ðð, Łł, Ʃʃ, Ħħ, Ææ, Øø...

    Last edited by DreymaR (Yesterday 12:09:47)
    Online
    • 0
    • Reputation: 16
    • From: UK
    • Registered: 14-Apr-2014
    • Posts: 402

    It didn't work, unfortunately. I had seen your "clearmods" arguments elsewhere but they are usually inside a Redirect command. Is it valid to have it in SetMods?

    Yes, it occurred to me that it would not be so easy to use the Shift+AltGr layer using this scheme. You would have to assign an extra key for it. For me it's not a problem as I'm use my AltGr layer mainly for symbols.

    One thing that was immediately nice about this idea though, is that AltGr location feels perfectly placed for a Shift key. I do like having it there!

    The original option #1 (AltGr+Space = Shift) is kind of OK but Shift feels too important to need two keys, whereas for AltGr it would be OK (subject to the limitation you pointed out).

    Last edited by stevep99 (Yesterday 12:44:35)

    Using Colemak Mod-DH with some additional ergonomic keyboard mods.

    Offline
    • 0
    • Reputation: 23
    • From: Bærum, Norway
    • Registered: 13-Dec-2006
    • Posts: 3,717

    There is a "real" lv3 modifier key in level3/modifier_mapping. Make sure this is activated somewhere:

      include "level3(modifier_mapping)"

    then try redirecting?

       key <SPCE> { symbols[Group1]=[ NoSymbol , ISO_Level3_Shift , NoSymbol , NoSymbol ,
                       Return               , Return                , // Enter
                       space                , nobreakspace         ], // Space
                     actions[Group1]=[NoAction(),Redirect(key=<LVL3>,clearmods=Shift),NoAction(),SetMods(mods=Shift),
                       Redirect(key=<RTRN>) , Redirect(key=<RTRN>)  , // <RTRN>
                       NoAction()           , NoAction()           ]
                   };  // <SPCE>

    A thought: If you aren't remapping your Shift keys, then Shift+AltGr could be set to provide layer4 (as before).
    AltGr → Shift (lv2)
    Shift(old or AltGr)+Space → AltGr (lv3)
    Shift+AltGr key → Shift+AltGr (lv4)

    Last edited by DreymaR (Yesterday 13:45:58)
    Online
    • 0
    • Reputation: 16
    • From: UK
    • Registered: 14-Apr-2014
    • Posts: 402

    No joy unfortunately, with the above have AltGr(Shift)+Space produces the same as as Shift. AltGr not being activated.

    Even if I can't get this to work, I am thinking to keep Shift on AltGr. The only question then is, for a conventional keyboard, what is the best thing to do with AltGr?

    Using Colemak Mod-DH with some additional ergonomic keyboard mods.

    Offline
    • 0
    • Reputation: 23
    • From: Bærum, Norway
    • Registered: 13-Dec-2006
    • Posts: 3,717

    Try this? It sometimes helps to be very explicit.

    Redirect(key=<LVL3>,mods=Mod5,clearmods=Shift)

    Try it with the physical Shift key and not your remapped AltGr key first, to isolate the problems.

    You're sure the include line I mentioned was active in your layout?

    And: Are you editing the entry in the extend file? If you've added it elsewhere, there may be competing definitions at hand. Fortunately, I think extend is added last (since it's an option) so it should win. But to make sure, do try to define another level of space as something exotic for testing purposes. (Don't leave yourself stranded without a space though!)

    Last edited by DreymaR (Yesterday 17:17:15)
    Online
    • 0
    • Reputation: 16
    • From: UK
    • Registered: 14-Apr-2014
    • Posts: 402

    Still no. Yes I tried including level3(modifier_mapping) at various points, but made no difference. Normal Shift or remapped Shift - both produce the same effect.

    Maybe what I could to is use the original config I had, "SetMods(mods=Mod5)".  This selects the fourth layer (Shift+AltGr), but maybe that's OK. I could just define my symbol layer there instead. It wouldn't be perfect, but it would work for people who only want one AltGr layer.

    Using Colemak Mod-DH with some additional ergonomic keyboard mods.

    Offline
    • 0
    • Reputation: 23
    • From: Bærum, Norway
    • Registered: 13-Dec-2006
    • Posts: 3,717

    Not sure how to help you without trying it out myself then (and I don't have time right now). Hope it works out! It's not the simplest problem I've come across but since I made Extend actually work I've come so far as to even impress the XKB gurus at times. ;-) So maybe we can pull it off.

    In the name of testing, could you try remapping the Shift state of Space to another key? With redirect and clearmods, it should give the unshifted key then. (In my Extend layers, I've mostly used clearmods=all, but I don't see why clearmods=Shift shouldn't work!) If that works, try adding a mods=Mod5 to see if you get the AltGr mapping for that key.

    When testing stuff, you always need to go from something simple that works to what you want to achieve, via as simple steps as possible.

    Lastly, remapping the shift state of the Space key to ISO_Level3_Shift should be enough in itself; did you try that without any actions? If that works, maybe there's room for an action that kills the shift state then?

    For max safety, the symbols section should contain this I think (although I believe it is usually included elsewhere anyway):

    modifier_map Mod5 { ISO_Level3_Shift };

    Note: According to the fabled Ivan Pascal, the only action that allows both setting and clearing of mods is indeed RedirectKey. There must be a way we could do this with that action...

    Last edited by DreymaR (Today 11:02:59)
    Online
    • 0
    • Reputation: 7
    • Registered: 12-Sep-2016
    • Posts: 19

    I also tried to implement it in XKB, but the problem is that you can't really remove modifiers in a key press. Redirect does have a clearMods field, but that only applies to that action. So, with "Redirect(key=<LVL3>,clearMods=Shift)", the <LVL3> key gets pressed without the shift modifier (which doesn't have any effect, since <LVL3> always has ISO_Level3_Shift as keysym), but the next key press will have shift active, since the clearMods=Shift only applied to the previous press, not this one.

    I think that using the fourth layer (Shift+AltGr) is indeed the best one can achieve in XKB.

    Online
    • 0