• You are not logged in.

Thumb key proposal for Shift and AltGr on standard keyboards

  • Started by stevep99
  • 29 Replies:
  • Reputation: 20
  • From: UK
  • Registered: 14-Apr-2014
  • Posts: 447

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: 27
  • From: Bærum, Norway
  • Registered: 13-Dec-2006
  • Posts: 3,868

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

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

Last edited by DreymaR (24-Mar-2017 13:23:24)
Offline
  • 0
  • Reputation: 20
  • From: UK
  • Registered: 14-Apr-2014
  • Posts: 447
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 (22-Mar-2017 10:32:56)

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

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

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 (22-Mar-2017 12:09:47)
Offline
  • 0
  • Reputation: 20
  • From: UK
  • Registered: 14-Apr-2014
  • Posts: 447

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 (22-Mar-2017 12:44:35)

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

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

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 (22-Mar-2017 13:45:58)
Offline
  • 0
  • Reputation: 20
  • From: UK
  • Registered: 14-Apr-2014
  • Posts: 447

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: 27
  • From: Bærum, Norway
  • Registered: 13-Dec-2006
  • Posts: 3,868

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 (22-Mar-2017 17:17:15)
Offline
  • 0
  • Reputation: 20
  • From: UK
  • Registered: 14-Apr-2014
  • Posts: 447

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: 27
  • From: Bærum, Norway
  • Registered: 13-Dec-2006
  • Posts: 3,868

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 (23-Mar-2017 11:02:59)
Offline
  • 0
  • Reputation: 9
  • Registered: 12-Sep-2016
  • Posts: 31

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.

Offline
  • 1
  • Reputation: 27
  • From: Bærum, Norway
  • Registered: 13-Dec-2006
  • Posts: 3,868

Thanks for that clarification, Aldo!

Maybe using lv4 for AltGr+Space and keeping a normal AltGr key somewhere else is the best solution then. In that case, it seems too messy for me! Having to switch levels 3 and 4 is a no-go in my case.

Interestingly, with TMK (converter/controller firmware) I think it shouldn't be too hard to do... :-)

Offline
  • 0
  • Reputation: 20
  • From: UK
  • Registered: 14-Apr-2014
  • Posts: 447

Thanks for the contributions guys. It would also be possible to achieve this in AHK too - it's a shame we don't have the equivalent on Linux. It seems for all its complexity,  xkb can be rather limited in some ways.

I have decided to stick with mapping right alt to shift, as that is a great solution that works on both my laptop and my proper keyboard. To reach the third & fourth layers, on my Ergo Pro I can make use of its split spacebar, but on my laptop I'd need an alternative solution... Perhaps CapsLock, a bit like what the Neo layout does.

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

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

You could just shuffle everything around in a simple-yet-brilliant way, like you usually do. For instance:

RAlt   → RShift
RShift → RAlt(?)
LAlt   → Extend
Caps   → LAlt

Sounds nice to me. I'd keep LShift around since it's commonly used. Maybe you don't need your physical RShift? If lost, it could be included in the Extend layer instead, for the situations where it's actually needed.

For now, this seems like a simpler and more robust option than squeezing stuff into the Space key. Had you not opted to make RAlt your Shift key, it'd been much simpler.

Actually... here's a new idea: Instead of messing with the Shift state, how about making Extend+RAlt into AltGr? If you don't remove your LShift or RShift, that'd make lv4 possible. It's nice enough to press both Alt keys (left one first) for AltGr, isn't it?

If that works, it'd be so elegant that I'd consider it myself. For implementation at least, and maybe even personal use.

It'd also tie in with my ideas of higher-level Extend using RAlt+Extend etc. LAlt then RAlt would make AltGr, while RAlt then LAlt would make Extend2 etc. Nice.

While we're on that topic though: I'm not sure I'm entirely on board with making LAlt the Extend key? To me it's actually less comfy to use than Caps. I'm talking about the Ext+S+T+N-type combos for instance (which in addition seem to have some scan-matrix problems with LAlt+S+N on my boards?). Takes some effort to tuck the left thumb under there for me.

With the Wide mod, the RAlt key seems a lot easier. Using DH(DbgHk)-mod, my thumbs rest right under D and H (non-modded QWERTY V and M) which makes RAlt only a single-width jump but LAlt a full double-width jump that feels quite contortive! (Caps, too, is a single-key stretch... albeit with a weaker finger.)

The Space bar is actually stupidly wide. There could have been another key for the left thumb, or at the very least better Alt and Win/GUI key positions. Of course, without the Wide mod it's just as bad on the right hand. So I guess us Wide modders can find a small comfort in this design weakness on that accord, at least.

Hmmm... how about:

RAlt   → Extend
LAlt   → AltGr
Caps   → LAlt

...with advanced functions from Alt (and Alt+Caps?) combos?

Yes, you lose your new-found Shift key that way. I know. The simplest way of getting it would be to just swap RAlt and RShift, I suppose? But I'm warming up to the RAlt-as-Extend idea, I may try that one out...

Or the simplest way:

RAlt   → Extend
Caps   → AltGr

(Since Caps is unnecessary anyway, but nice enough as a key?)

Last edited by DreymaR (24-Mar-2017 13:56:53)
Offline
  • 0
  • Reputation: 20
  • From: UK
  • Registered: 14-Apr-2014
  • Posts: 447

I have thought about the possibility of simply switching Shift with RAlt, but I was a reluctant to mess around with the default shift keys. Remapping the Alt keys seems safer as they tend to be less used, yet have good positions.

The Alt keys vary in position somewhat - on conventional full-size keyboards, the Alts are often stupidly tucked away in a hard-to-reach position due the oversize spacebar. On laptops though, it is usually better. On my laptop, LAlt is directly below (angle-mod) C, which is useable as Extend. My Ergo Pro has Alt even closer to the centre which is better still. Extend on Caps is OK for right hand side keys, but I find having it on LAlt is much better for the left-hand keys, *especially* for those those Ext+S+T+N-type combos!

I was half tempted to get one of those Mistel Baroccos as a portable keyboard, but one thing that puts me off is the position of the Alt keys. It is quite a flaw!

I think there was a discussion in the forum previously about having Extend on the RHS. But wouldn't you want the arrows on the opposite side though, so you'd mirror the layout and have arrows on FRST (or perhaps WARS)?. For some reason Extend seems more naturally to belong on the left to me, maybe just because I'm used to it.

Although I haven't had any scan matrix problems with Ext+S+T+N etc, I have run into problems when using both Alts simultaneously. I did some tests with Extend(on LAlt) + RAlt  (i.e. layer 7) in the past, but found certain keys didn't work e.g. G and O. Otherwise both Alts together would indeed make quite a good combo to for accessing an extra layer! Still, I think this is a worthy idea, and might be worth a try. Not sure how you'd configure it though, as you'd be changing the meaning of RAlt depending on whether it's pressed alone or in combination with Extend. Wouldn't we run into the same problems as above?

I suppose it comes down to the fact that since all keyboards have Alts, I need the two most important modifiers on those two keys. For me the two most loved modifiers are Extend and Shift, so they are the obvious candidates. Although RAlt is nice, especially with a custom layer, it's less important than shift, so it has to make way. But somewhere like Caps or even RShift are not unreasonable locations for it.

Last edited by stevep99 (24-Mar-2017 15:00:39)

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

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

• I'd think that swapping RShift and RAlt would be quite safe and mentally nice, as they're so close to each other! You wouldn't be losing the RShift key and it's a bit redundant anyway.

• On my laptop board the LAlt is under unmodded X, as on yours. That doesn't feel so comfortable for something as important as Extend to me. As mentioned, my left thumb rests a whole key width into the space bar so it's a double-key stretch inwards for the thumb. Good enough for Alt but not for Extend in my opinion.

• I agree that the Extend feels best on the left. One reason may be that the left hand on modifiers while the right hand hits arrow keys etc is the common way? But I'm also very used to hitting keys with the RAlt key down due to AltGr, so maybe that'll work just fine as my Extend modifier? Holding the RAlt while hitting, e.g., UNEI seems comfy enough. I want to try it.

• I hope RAlt doesn't cause me any further scan matrix woes? Could be, since it may mask one of the NEI keys. I think my LAlt masks the S key vertically in my matrix. It's quite horrible really if they put the modifiers in the same matrix as the other keys, but I wouldn't put it beyond them. The physical Shift key has to be on its own connection I guess, as it's chorded so much with the rest of the keys.

• The good way to access extra layers would be chording while accessing but only holding one of the modifiers thereafter. That way, fatigue/contortions and scan matrix worries shouldn't compound.

• I have some clearmod arguments in my Extend mappings to make sure keys are redirected without the level5 shift state. That works well it seems, even on the Extend-modifiers (A/S/T). But if the level5 state is cleared on redirecting to, say, an arrow key, then it wouldn't matter if it was kept up to that point. So that's a difference from the problem with the shift state and level3 above. I think.

Last edited by DreymaR (24-Mar-2017 15:54:18)
Offline
  • 0
  • Reputation: 27
  • From: Bærum, Norway
  • Registered: 13-Dec-2006
  • Posts: 3,868

Hang on...

If you have RShift mapped to your RAlt key and let Shift+Space be AltGr/Mod5, then wouldn't you get level3 if you hit Shift+Space then release RAlt/Shift while keeping Space depressed? Because then I'd think that the level3 state is still active while the shift state goes away!?

I'm hoping that the key repeat function doesn't mess this up.

Last edited by DreymaR (24-Mar-2017 15:51:42)
Offline
  • 0
  • Reputation: 27
  • From: Bærum, Norway
  • Registered: 13-Dec-2006
  • Posts: 3,868

Update: I made the RAlt-Extend with TMK and it seems to be working really well! And without any scan matrix trouble, to boot.

It's a bit more dramatic than using Caps since I was already using the AltGr key for something else as opposed to the largely unused Caps key. But it actually feels rather nice to have the Caps key as the lv3 shift right above the lv2 shift! Heh.

Also, it's interesting that Ext-Enter(Ext+Space) goes from 1-handed to 2-handed, but Ext-Back(Ext+O) vice versa! Not a problem, just unaccustomed.

I'll test this some more and then maybe make it a standard Extend-key option. If I do, I'll make both Alt keys potential Extend keys I guess, for freedom of choice.

Last edited by DreymaR (24-Mar-2017 16:04:00)
Offline
  • 0
  • Reputation: 20
  • From: UK
  • Registered: 14-Apr-2014
  • Posts: 447
DreymaR said:

Hang on...

If you have RShift mapped to your RAlt key and let Shift+Space be AltGr/Mod5, then wouldn't you get level3 if you hit Shift+Space then release RAlt/Shift while keeping Space depressed? Because then I'd think that the level3 state is still active while the shift state goes away!?

I'm hoping that the key repeat function doesn't mess this up.

Nice! You hit the jackpot with that suggestion, it totally works!

And it's quite an easy and nice action to do, probably better than holding both keys down in fact!  I am going to keep this configuration on my laptop :P

DreymaR said:

Update: I made the RAlt-Extend with TMK and it seems to be working really well! And without any scan matrix trouble, to boot.
...
I'll test this some more and then maybe make it a standard Extend-key option. If I do, I'll make both Alt keys potential Extend keys I guess, for freedom of choice.

Yeah, I think that would be good. Extend is such an excellent feature, that it deserves to have options, especially since there is some degree of variation in the Alt positions on different keyboards.

This has turned into quite a productive thread!

Last edited by stevep99 (25-Mar-2017 17:41:54)

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

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

I love those productive threads. <3

I hate remapping modifiers though. Ugh. First snag is PKL: Remapping AltGr (or something to AltGr) is not straightforward in AHK, since AltGr is interpreted as LCtrl&RAlt.

This fails for me:

extend_key = RAlt

This, too:

SC138 = CAPITAL	0	--	--	--	--	--	; RAlt/AltGr is Extend
SC03A = RMENU	VirtualKey

(As far as I could see, RMENU is the correct Windows Virtual Key Code for RAlt. Some of those codes are a bit weird.)

Any suggestions, anyone?

Last edited by DreymaR (27-Mar-2017 11:17:53)
Offline
  • 0
  • Reputation: 9
  • Registered: 12-Sep-2016
  • Posts: 31

I haven't looked at PKL for a while, but if I use my KLFC, it generates

extend_key = RAlt

and

RAlt = disabled

This works for me if the US layout is active. But with an international layout, control will also be activated (Extend+N moves the cursor a word back instead of a letter)...

Offline
  • 0
  • Reputation: 20
  • From: UK
  • Registered: 14-Apr-2014
  • Posts: 447

I used to do stuff like this in AHK for making a custom AltGr layer, which used to work fine for me:

RAlt & SC020::
  GetKeyState, sh, Shift
  if sh = D
    Send {→}
  else
    Send {{}
return

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

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

Stevep: I see how that works in your example, but apparently something's up with the extend_key usage in PKL that doesn't make it so simple anymore? I'm guessing that while your example may look at only RAlt and ignore the concommitant LCtrl, PKL won't do this.

Aldo: I don't understand what you meant by that, KLFC? Is that a PKL fork, now? And how did it generate those entries? Sorry, confused here.

The reason Ctrl will be activated with AltGr-Extend must be that LCtrl remains while Extend picks off the RAlt part of the AltGr press.

To fix this, I guess we'll have to fix the PKL source code. For now, I think I may opt to test this outside of PKL by using a registry or KLC remapping of the AltGr and Caps keys. That should be robust, if a bit clunky.

Last edited by DreymaR (28-Mar-2017 13:03:26)
Offline
  • 0
  • Reputation: 9
  • Registered: 12-Sep-2016
  • Posts: 31

My KLFC is definitely not a PKL fork. But it generates keyboard layout files, including PKL ones. By changing the singleton key '[ "CapsLock", "Extend" ]' to '[ "Alt_R", "Extend" ]' in the extend example, it will generate PKL files where the important changes are the lines I gave.

Offline
  • 0
  • Reputation: 1
  • Registered: 04-Feb-2010
  • Posts: 143

Not to derail the thread, but referring back to the opening post: I hate single thumb key keyboard design, but this is not the solution I am looking for.

Keys to character ratio is pretty much exponential. 1-1 is less than ideal, 2-1 (standard shift or Alt-Gr character) is bad, 3-1 is horrendous, 4-1 is - to my mind - damn near unthinkable.

Also this fails to solve the whole "non-modifiable function key" problem of at least Windows and Chrome OS. Which means you are stuck with software/hardware keyboard remappers, or even worse, lugging around a programmable keyboard.

If you are going to go that far, there have got to be better options. Frankly, limiting yourself to L.Shift only with "sticky keys" turned on is not that terrible. Just disappointingly inefficient.

Offline
  • 0