Author Topic: Dual-role keys  (Read 27173 times)

0 Members and 1 Guest are viewing this topic.

Offline hasu

  • Thread Starter
  • Posts: 2757
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Dual-role keys
« on: Tue, 26 March 2013, 02:09:10 »
Dual-role key works as modifier, Fn(layer switch) or other function when you hold it while normal key when you press and release it quickly. With this trick you can have two function on one physical key.

http://en.wikipedia.org/wiki/Modifier_key#Dual-role_keys

This video demonstrates my implementation of dual-role keys on Poker cursor keys. This setup places Up on Shift, Left on Alt, Down on Super and Right on Control.


Any other useful idea, tool or resourse?


Implementations:
* TouchCursor [WIN] (http://touchcursor.sourceforge.net/)
* xcape[X11] (https://github.com/alols/xcape)
* lydell's dual[AHK] (https://github.com/lydell/dual)
* BigCtrl[AHK] (https://github.com/benhansenslc/BigCtrl)
* Space 2 Control[X11] (https://github.com/r0adrunner/Space2Ctrl)
* At home modifier[X11] (https://gitorious.org/at-home-modifier/pages/Home)
* Karabiner[Mac](https://pqrs.org/osx/karabiner/) - KeyOverlaidModifier
* keydouble[X11](https://github.com/baskerville/keydouble)
* tmk firmware Tapping[AVR] (https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md#4-tapping)
* evdev-spacefn[X11/evdev] (http://www.ljosa.com/~ljosa/software/spacefn-xorg/ https://geekhack.org/index.php?topic=51069.msg2540818#msg2540818)

Ideas:
* SpaceFN layout - suggested by spiceBar
* Shift/Space on Space - known as SandS in Japan
* Control/Backspace on Caps Lock
* Control/Esc on Caps Lock    (stevelosh.com)
* (/LShift and )/RShift    (stevelosh.com)
* Mods on home row


Resources:
* Matias one-handed keyboard uses similar technique(paper '96) - product page: half keyboard
« Last Edit: Thu, 28 December 2017, 19:33:09 by hasu »
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline automator

  • Posts: 9
Re: Dual-role modifier keys
« Reply #1 on: Tue, 26 March 2013, 07:23:00 »
Cool... do you notice a lag on arrow?  I assume it doesn't register until keyup.

Offline hasu

  • Thread Starter
  • Posts: 2757
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Dual-role modifier keys
« Reply #2 on: Tue, 26 March 2013, 08:09:18 »
You are right. There is actually a lag and it is noticeable if you care but no problem on normal text edit, I think.

Repeating will be rather a problem for most people. You must do tap and hold dual-role key to get auto repeat instead of just hold.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline SmallFry

  • ** Moderator Emeritus
  • Posts: 3887
  • Location: Wisconsin, USA
  • Leaving 6/15; returning 6/22 or so.
Re: Dual-role modifier keys
« Reply #3 on: Tue, 26 March 2013, 09:41:45 »
How do you implement this in your firmware, or is it computer based?

Offline hasu

  • Thread Starter
  • Posts: 2757
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Dual-role modifier keys
« Reply #4 on: Tue, 26 March 2013, 12:09:56 »
It is implemented in firmware and configurable with keymap, because I like to have OS independent configuration in keyboard itself instead of setup on each machine.

You can find some software tools support this trick in the wikipedia page. I think keyremap4macbook also supports a kind of this feature. AHK can be used to implement this, of course.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline eon

  • Posts: 79
  • Location: France - Brittany
Re: Dual-role modifier keys
« Reply #5 on: Tue, 26 March 2013, 12:35:18 »
Very cool

So is it possible to modify the poker firmware ? Or I didn't understand a thing  :-\
Poker MX Red - Photos

Offline hasu

  • Thread Starter
  • Posts: 2757
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Dual-role modifier keys
« Reply #6 on: Tue, 26 March 2013, 12:48:15 »
Sorry, I wasn't clear. I used prototype of GH60 with Poker keycaps and case in the video.
Stock Poker is not programmable so you can't modify its firmware.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline esoomenona

  • Gnillort?
  • Posts: 5323
Re: Dual-role modifier keys
« Reply #7 on: Tue, 26 March 2013, 12:50:38 »
Mhm, mhm. Bring on the GH60s!

Offline SmallFry

  • ** Moderator Emeritus
  • Posts: 3887
  • Location: Wisconsin, USA
  • Leaving 6/15; returning 6/22 or so.
Re: Dual-role modifier keys
« Reply #8 on: Tue, 26 March 2013, 13:27:45 »
How is it implemented in the firmware, for example, how do I set it up in your firmware?

Offline hasu

  • Thread Starter
  • Posts: 2757
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Dual-role modifier keys
« Reply #9 on: Tue, 26 March 2013, 13:59:40 »
If you are interested in implementation source is available on github. https://github.com/tmk/tmk_keyboard

This part of my keymap.c. To define dual-role mod key use ACTION_RMOD_TAP_KEY. Not documented yet.
https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md

Code: [Select]
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    KEYMAP_ANSI(
        ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC, \
        TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS, \
        LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   FN2, QUOT,     ENT,  \
        LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, FN1,           FN12, \
        LCTL,LGUI,LALT,          SPC,                     FN13,FN9, FN10,FN11),
};

static const uint16_t PROGMEM fn_actions[] = {
    [9] = ACTION_RMOD_TAP_KEY(KC_RALT, KC_LEFT),
    [10] = ACTION_RMOD_TAP_KEY(KC_RGUI, KC_DOWN),
    [11] = ACTION_RMOD_TAP_KEY(KC_RCTL, KC_RIGHT),
    [12] = ACTION_RMOD_TAP_KEY(KC_RSFT, KC_UP),
}
« Last Edit: Tue, 26 March 2013, 14:05:19 by hasu »
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline SmallFry

  • ** Moderator Emeritus
  • Posts: 3887
  • Location: Wisconsin, USA
  • Leaving 6/15; returning 6/22 or so.
Re: Dual-role modifier keys
« Reply #10 on: Tue, 26 March 2013, 14:02:06 »
Danke! Will try this out later.

Offline eon

  • Posts: 79
  • Location: France - Brittany
Re: Dual-role modifier keys
« Reply #11 on: Wed, 27 March 2013, 05:00:01 »
Will definitively try this out when I have my GH60.

Thanks hasu
Poker MX Red - Photos

Offline ComradeSniper

  • HHKB Pro
  • * Esteemed Elder
  • Posts: 1086
  • Location: Montana
Re: Dual-role modifier keys
« Reply #12 on: Wed, 27 March 2013, 18:09:11 »
That is really cool. Now I want a GH60 even more.

Offline islisis

  • Posts: 119
  • Location: Tokyo, Japan
Re: Dual-role modifier keys
« Reply #13 on: Sun, 07 April 2013, 09:24:33 »
I really would love to see how dual role modifiers perform programmed in a microcontroller. I have spent some time prototyping variations in AHK, and implementing them properly in Linux is one of my big future goals. So, here I am posting my manifesto.

A lot of the functions I am using are tied with OS interface, but there are obviously common issues worth discussing:

1. A major one being, how do you deal with rollover? It is natural for multiple keys to be held down while typing quickly, without the intention for triggering a chord. AHK seems to handle an endless number of key remaps very effectively, so I am able to actually remap every single key to
  a) detect if D-R mod key is held
  b) 'sleep' for 70ms, and detect if D-R mod key is still being held
  c) if yes, overwrite key function with modifier layer
  d) else, perform original key function
(in addition to buffering input of the original D-R function to ensure the correct order of keypresses)

Sorry if this is explicit in your code, but I thought I would ask for some ideas in English (well, Japanese is okay too but :P)

If this were to be a mainstream implementation, what are the foreseeable issues which experienced and laypeople alike might encounter? Personally, I think achieving this sort of behaviour in software, let alone an interpreted script, will always leave it open to conflicts when CPU(s) are held up. However, in my mind this is a compromise worth taking for a lot of users. I plan to spend a lot of time researching possibilities for a mainstream implementation.

2. I don't think spacebar is good for a D-R key at all for this reason (in addition to upstroke activation being too annoying), even though it is clearly the most popular candidate and definitely useful in many specific scenarios. Likewise, I believe common alphanumeric keys should be excluded in default layouts - chorded keyboards should be classed in a separate use category from mainstream/downstroke activated keyboards, otherwise confusion/feel will forever prevent its acceptance. In the case of a kinesis-style mapping, backspace (left thumb) works very well. Tab is another good candidate (capslock also, but often reserved as dedicated ctrl). An actual kinesis/ergodox can use capslock, home, end (del also, but better as a dedicated mod key) - for the left side alone. On the right side, ralt, ' and \ are natural candidates.

3. Auto-repeat (see next post)

4. As for usage ideas, my position is that any layer function that is truly invaluable deserves a dedicated non D-R modifier key, because of the issue in 1. Therefore I treat any D-R layer as a 'convenience' layer. You can put in some useful highlight+copy/cut/paste style editing macros in there. Window functions like ctrl(shift)-tab, virtual desktop switching. Mouse functions can be vital to alleviate RSI. If you could make a quick record/play text macro function bindable to number keys etc that would be great. When combined with software mapping, mouse gestures, per application shortcuts, and much more. Even a simple alias for ctrl+alt+shift has its uses. On the kinesis/ergodox I count >600 accessible global shortcuts - for the LHS alone. I am currently testing use of ~120 LHS shortcuts.

5. In the end the most important problem is standardisation. This will mean common functions will take a long time time to emerge from the community's choices. Related issues apply to the mouse button equivalent also, rocker gestures. One which incorporates some smart mnemonics will likely prove the winner. So, it's worth discussing imho.

Anyhow, looking forward to see what hardware functions you guys come up with.
« Last Edit: Fri, 24 May 2013, 00:50:40 by islisis »

Offline islisis

  • Posts: 119
  • Location: Tokyo, Japan
Re: Dual-role modifier keys
« Reply #14 on: Sun, 07 April 2013, 09:33:26 »
Repeating will be rather a problem for most people. You must do tap and hold dual-role key to get auto repeat instead of just hold.

There is this issue also. Personally I don't find auto-repeat necessary so I have it disabled, but before that I let the mod key wait a timeout period for another key to be pressed. If the timeout was reached while still being held down, it would repeat.

It's much more useful for me to have it auto-cancel the original key function after the timeout instead, because accidental (read "I changed my mind" aka "I just enjoy pressing random modifier keys") presses are an obvious issue I should have stated. Alternatively you can set a follow-up 'cancel key'. I guess that you sensed this also, and so implemented a separate method for auto-repeat. Sounds good.

Finally, I'm going to take the liberty of an off-topic rant/question here: is there no plan for a JP layout of the GH60? Because, for reasons including the topic of this thread, I would like to see thumb modifiers a widespread option for keyboards in the future.
« Last Edit: Sun, 07 April 2013, 10:34:49 by islisis »

Offline Findecanor

  • Posts: 3867
  • Location: Stockholm, Sweden
  • Does not take bull****
Re: Dual-role modifier keys
« Reply #15 on: Sun, 07 April 2013, 10:18:35 »
Dual-role mod works as modifier when you press and hold it but as other normal key when you tap.
I have been thinking about something that is slightly different that would take this further: combine the Alt and Fn keys.
The reasons why are 1) there are so few key combinations with Alt in the programs that I use, but the few that I use, I use very often. 2) I want to minimise my number of modifiers. I have also Shift, Control and Alt Graph.

When you press and release the Fn/Alt-key it would produce a quick tap and release of the Alt key, but if you hold it and press another key it would enable Fn-layer.
However, you would also be able to map a key combination with Alt, such as "Alt-Tab" to a key on the Fn-layer.
If you press Fn/Alt, then Tab and then release Tab, it would register as holding the Alt key as long as you hold down the Fn/Alt key, but the active layer should still remain the Fn-layer. If you now press another key, then its symbol on the Fn-layer would register as pressed together with Alt.

The problem I have is selecting a simple and consistent policy for how the mechanism should work. Should there only be a "bit" on the key on the Fn-layer that would activate the Alt symbol or should there be support for all kinds of modifier combinations on a key?
For instance, should I be able to map a combination with Control to a key on the Fn-Layer and should the Fn/Alt key then be temporarily assigned to Control?
« Last Edit: Mon, 08 April 2013, 08:28:57 by Findecanor »
Smoking is assault. I defend myself.
Daily driver: Phantom (Lubed Cherry MX Clear, Lasered Cherry PBT keycaps with Row A. Plastic "Frankencase". Custom firmware, Swedish layout)

Offline n0rvig

  • Posts: 337
Re: Dual-role modifier keys
« Reply #16 on: Sun, 07 April 2013, 12:01:08 »
Nice! This is exactly what makes the GH60 so exciting! I'm looking forward to having CAPS-LOCK remapped to CTRL / ESC in hardware for Vim.

I've been meaning to setup dual-role modifier keys ever since I read Steve Losh's modern space-cadet post.
http://stevelosh.com/blog/2012/10/a-modern-space-cadet/

Offline hoggy

  • * Ergonomics Moderator
  • Posts: 1464
  • Location: Isle of Man
Re: Dual-role modifier keys
« Reply #17 on: Sun, 07 April 2013, 14:59:25 »
I think Steve Losh's idea of re-using the shift keys for ( and ) is simply genius.
GH Ergonomic Guide (in progress)
http://geekhack.org/index.php?topic=54680.0

Offline hasu

  • Thread Starter
  • Posts: 2757
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Dual-role modifier keys
« Reply #18 on: Sun, 07 April 2013, 22:56:21 »
islisis, hey.
It is uncommon to see and discuss with other Japanese member on this forum :D It is fun!

As for repeat and cancel thing I totally agree with you. In fact cancel is more useful or important than repeat. In my firmware I use 200ms for timeout. I can cancel a key with holding during the term.
I'll read and reply with your another post later.
                                                             
Off-topic is a fun part and nature of this forum :)                                               
I think GH60 supports JIS layout except bottom row. But we need more thumb keys, right? I'm not a fan of space and mods of JIS, instead I prefer split of space bar like Erase Eaze.   
http://geekhack.org/index.php?topic=41724.msg841006#msg841006


Repeating will be rather a problem for most people. You must do tap and hold dual-role key to get auto repeat instead of just hold.

There is this issue also. Personally I don't find auto-repeat necessary so I have it disabled, but before that I let the mod key wait a timeout period for another key to be pressed. If the timeout was reached while still being held down, it would repeat.

It's much more useful for me to have it auto-cancel the original key function after the timeout instead, because accidental (read "I changed my mind" aka "I just enjoy pressing random modifier keys") presses are an obvious issue I should have stated. Alternatively you can set a follow-up 'cancel key'. I guess that you sensed this also, and so implemented a separate method for auto-repeat. Sounds good.

Finally, I'm going to take the liberty of an off-topic rant/question here: is there no plan for a JP layout of the GH60? Because, for reasons including the topic of this thread, I would like to see thumb modifiers a widespread option for keyboards in the future.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline hasu

  • Thread Starter
  • Posts: 2757
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Dual-role modifier keys
« Reply #19 on: Sun, 07 April 2013, 23:04:37 »
Findecanor,                                                                                       
to be honest it is not clear your idea to me.
As you know dual-role modifier basically handles a modifier(including Fn) and a normal key, it won't work on a combination of two modifiers like Alt and Fn. I couldn't get how to discriminate those Alt and Fn from your explain. Can you describe more actual example of keymap or layer you want to define?

n0rvig, hoggy,
I added them on my first post for reference. Thank you!
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline hoggy

  • * Ergonomics Moderator
  • Posts: 1464
  • Location: Isle of Man
Re: Dual-role modifier keys
« Reply #20 on: Mon, 08 April 2013, 04:31:23 »
There's also the old classic of shift and space.

Press and release the space bar for space, space bar and a for A.
GH Ergonomic Guide (in progress)
http://geekhack.org/index.php?topic=54680.0

Offline hasu

  • Thread Starter
  • Posts: 2757
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Dual-role modifier keys
« Reply #21 on: Mon, 08 April 2013, 11:52:53 »
I really would love to see how dual role modifiers perform programmed in a microcontroller. I have spent some time prototyping variations in AHK, and implementing them properly in Linux is one of my big future goals.
Can you post your AHK scripts somewhere like gist/pastbin to share? They will be useful for someone to start this.


Quote
1. A major one being, how do you deal with rollover? It is natural for multiple keys to be held down while typing quickly, without the intention for triggering a chord. AHK seems to handle an endless number of key remaps very effectively, so I am able to actually remap every single key to
  a) detect if D-R mod key is held
  b) 'sleep' for 70ms, and detect if D-R mod key is still being held
  c) if yes, overwrite key function with modifier layer
  d) else, perform original key function
(in addition to buffering input of the original D-R function to ensure the correct order of keypresses)

Sorry if this is explicit in your code, but I thought I would ask for some ideas in English (well, Japanese is okay too but :P)

If this were to be a mainstream implementation, what are the foreseeable issues which experienced and laypeople alike might encounter? Personally, I think achieving this sort of behaviour in software, let alone an interpreted script, will always leave it open to conflicts when CPU(s) are held up. However, in my mind this is a compromise worth taking for a lot of users. I plan to spend a lot of time researching possibilities for implementation.
I use key event buffer whose size is 8(*6byte) atm to keep events while DRmod key is undetermined yet.
Rules determining whether DRmod should perform as key or modifier are very simple:
1. Judging term (200ms in my case) elapsed(timeout) => modifier
3. DRmod is released within 200ms(tapping)  => key
Rules are simple but implementation will be a bit complex to handle some exceptional case. Looks like memory space and CPU cycles needed by my code are reasonable and no problem on AVR controller.

What is your problem about 1. actually? Erroneous decision of whether key or mod? I think you may be able to improve it much with tweaking code and parameters for your preference.
I have improved my code gradually for two years including rewriting from scratch and now happy with it.


Quote
2. I don't think spacebar is good for a D-R key at all for this reason (in addition to upstroke activation being too annoying), even though it is clearly the most popular candidate and definitely useful in many specific scenarios. In the case of a kinesis style mapping, backspace (left thumb) works very well. Tab is another good candidate. The kinesis also can also use capslock, pgup, pgdn - for the left side alone.
It depends on your type speed and style. I have had layer switch feature on space bar for about two years and erroneous decision is very rare with my latest implementation. But I'm a slow typist and don't type much daily. Of course, you don't have to use space bar if you have another options.

« Last Edit: Mon, 08 April 2013, 11:54:31 by hasu »
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline hoggy

  • * Ergonomics Moderator
  • Posts: 1464
  • Location: Isle of Man
Re: Dual-role modifier keys
« Reply #22 on: Mon, 08 April 2013, 13:19:33 »
Someone on superuser.com worked this up for me.

LShift UP::Send, (
RShift UP::Send, )
LShift & F13::
RShift & F13::

GH Ergonomic Guide (in progress)
http://geekhack.org/index.php?topic=54680.0

Offline islisis

  • Posts: 119
  • Location: Tokyo, Japan
Re: Dual-role modifier keys
« Reply #23 on: Mon, 08 April 2013, 16:04:14 »
edit: re-reading your explanation, I think we both solve the issue of DR decision - if I now understand correctly, after the DR mod is pressed you use a buffer to hold subsequent keystrokes until 200ms has passed, or the DR mod key is released; this sounds optimal to me, I'm sure it works great. In my example I wait 70ms.

I am glad to finally see this taken into consideration because such a buffer is absent in many implementations. Having it in microcontroller is a really good option, script is the worst. Posting my AHK script would not make the issue any clearer (AHK is also not optimal for DR rollover detection, for instance I originally wanted to implement it your way but it doesn't seem possible). I will explore the options to implement it efficiently in software for a mainstream release, and that will mean Linux.

Also I would be interested to hear what key functions you have found useful over your 2 years of testing!

It is uncommon to see and discuss with other Japanese member on this forum :D It is fun!

I think it is more uncommon to see Japanese people with English as good as yours! That may be the reason. I can speak Japanese and live here, but I'm not Japanese myself!

I think GH60 supports JIS layout except bottom row. But we need more thumb keys, right? I'm not a fan of space and mods of JIS, instead I prefer split of space bar like Erase Eaze.   
http://geekhack.org/index.php?topic=41724.msg841006#msg841006

The more thumb keys the better, in my opinion :D So a split space bar is great. The JIS layout is a standard, however, which makes it easier for people find keyboards for. This is why I thought it could be an option for GH60 as well :/ Of course custom is better for us!
« Last Edit: Mon, 20 May 2013, 09:21:25 by islisis »

Offline hasu

  • Thread Starter
  • Posts: 2757
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Dual-role modifier keys
« Reply #24 on: Mon, 08 April 2013, 23:09:23 »
Thanks for your explanation hasu! I could have examined your code, but now I think I understand your implementation. The issues I described are related to instant registering of DR mod key presses. In your case, the user's intention is unambiguous because they will first have to wait 200ms before the modifier is registered. Other implementations, including mine and the also code pasted by hoggy, don't register DR in the same way - registration starts instantly as soon as the DR and target keys are rolled-over. Personally I find this action is desirable because then I can use DR chords in the same way as standard modifier chords.

Ah, other implementations works that way? Looks like I should look into other tools for detail of implementation. I didn't come up with that optimization and I for one didn't find need of that. I don't find that lag on my normal usage but other may bother it.

In my implementation you don't have to wait 200ms for typing next key but you have to hold the DRmod key for 200ms at least. If you release the key before that you get a key function. I believe this behavior is need for better roll-over support.
I'm willing to admit that fast typist will suffer from this limitation even though the time parameter is configurable.

Which optimization method is better seems to  depend on whether you use a DRkey mainly as key or mod. I use my DRkeys(; / space) as key than mod and my implementation is optimized for that.

Seems like we need configurable option to select favorite optimization methods.


Quote
In the instant case, however, as I have explained a commonly used key like space this will cause issues for any typer eventually, because even a millisecond of overlapping keypresses will trigger the DR layer. This is why I am surprised not to see it mentioned in many discussions.
To avoid this false detection I believe we need the inevitable lag time in the end. And I think my firmware works well on this thing. To get space you are only required to type a key with the timeout period, this is very easy to fulfill.

Two optimization policies(key first/mod first) seems to be incompatible each other. I think we can get way better result using proper policy.


Simple AHK script hoggy posted above is good for start point, but it doesn't has any optimization. So it suffers from this problem. Also it has no cancel/timeout feature.
With the script if you type LShift, A and RShift quickly to get '(a)',  you will get 'A)'.






Quote
Sorry for causing the confusion, I hope my intention for discussion is clear now >_< Also I would be interested to hear what key functions you have found useful over your 2 years of testing!
I've used mainly 'semicolon' for mousekey layer, 'space' for second mousekey layer and 'slash' for cursor key layer. Recently I started using RShift  for `(grave) on my proto GH60.
I have almost no problem on these keys now, but they are less used relatively compare to alpha keys.
Now I have a plan for testing dual-mod key on home row keys like asdfjkl to see how my implementation goes under harsh environment :D


Quote
It is uncommon to see and discuss with other Japanese member on this forum :D It is fun!

I think it is more uncommon to see Japanese people with English as good as yours! That may be the reason. I can speak Japanese and live here, but I'm not Japanese myself!
Haha, I tend to jump to (wrong) conclusions :)

TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline islisis

  • Posts: 119
  • Location: Tokyo, Japan
Re: Dual-role modifier keys
« Reply #25 on: Mon, 08 April 2013, 23:26:44 »
Sorry hasu I re-read your explanation tried to edit my post before you saw it, but was too late!

Ah, other implementations works that way? Looks like I should look into other tools for detail of implementation. I didn't come up with that optimization and I for one didn't find need of that.

No, ignore my statement - I first thought that target keys would be ignored during the 200ms period, but then I saw that your implementation will use a buffer to detect keypresses, so the result is the same. I think your method is best, sorry again for the confusion!

And you are right that hoggy's example has no buffer implementation. It's not easy to do in AHK.

edit:
Thanks for your examples, I see I need to research much more and am amazed by how useful your full firmware is. I am interested in software implementation, so I will research methods for invoking arbitrary numbers of modifier keys, hopefully to achieve what you already have!
« Last Edit: Tue, 09 April 2013, 05:48:26 by islisis »

Offline lydell

  • Posts: 42
  • Location: Sweden
Re: Dual-role modifier keys
« Reply #26 on: Sat, 18 May 2013, 16:40:30 »
I've been using BigCtrl (AHK script) for a few months, and it has worked very well. It combines space and control, and uses timeouts to prevent mistakes (and does it well!).

Today I realized that one could take this one step further: Not only make modifier keys also into normal keysbut normal keys also into modifier keys! I'm thinking about putting modifier keys on the home row, for example, say, shift on the index fingers. Sounds awesome to me, I just have find the time to learn AHK (but BigCtrl is good starting point I guess). Has anyone tried this before?

Offline hasu

  • Thread Starter
  • Posts: 2757
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Dual-role modifier keys
« Reply #27 on: Sat, 18 May 2013, 19:19:09 »
I'll add a link to BigCtrl on first post, it looks like a clean, concise and well documented code, it'll be good for starting point. I didn't know this tool yet. Thanks.

Placing modifiers on home row is nice idea. I've used ';' as modifier happily for a few years but never tried other home keys. If you use alpha keys as modifier it'll be important to choke off false detection as possible with tweaking code or parameters. It is really challenging idea.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline lydell

  • Posts: 42
  • Location: Sweden
Re: Dual-role modifier keys
« Reply #28 on: Thu, 04 July 2013, 17:45:17 »
I've made some progress on implementing dual-role keys with AutoHotkey. It was a lot harder than I expected I will now start experimenting with dual-role home keys. I'll report back when I have more experience.

Offline hasu

  • Thread Starter
  • Posts: 2757
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Dual-role modifier keys
« Reply #29 on: Fri, 05 July 2013, 05:55:31 »
Wow, great work!
I read through readme, very nice write up too!
This make me find new issue I've missed so far, which is "bob" case of DoublePress. Hmm, look like I need to work this case on my firmware.

And I'll try your ahk script later when I'm back on windows.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline lydell

  • Posts: 42
  • Location: Sweden
Re: Dual-role modifier keys
« Reply #30 on: Sun, 01 September 2013, 14:21:16 »
So it's been two months, and I said that I should report back. Here are some experiences:

First off, I have not used dual-role modifiers for two months! Why? Because it has been a nightmare to implement. Countless times I have thought that I've nailed it, but a few minutes of real usage has usually been enough to find it totally unusable: There has always been some quirk killing all the pros of dual-role keys. I guess it is a combination of having bad programming days, being quite new to AHK, quirks of AHK, and that dual-role keys actually are difficult to implement. This has been very frustrating, and therefore I lost the motivation to work on it for periods of time. Moreover, I have had more to do than hacking on keyboards ;)

However, three days ago I finally came up with a version (0.3.1) of my AHK script that I actually could use. In just a few days I have grown to absolutely love it! And after fixing a very annoying bug today (making characters output in backwards order), it works really smoothly.

For the moment, I have put shift on the index fingers, control on the middle fingers and alt on the ring fingers, all on the home row. Then I have the Windows keys on the middle fingers in the top row.

At first I almost could not stand the lag introduced by the characters appearing on keyup, but now I almost don't notice it. It is totally worth the lag having the modifiers in such convenient spots. It is super easy to press for example control-shift-alt-x now.

One thing that really made a big difference in my script, is the ability to have key-level settings (which I added in version 0.3.0). I use 70ms delay by default, and 200ms for the alt and Windows dual-role keys.

Offline Findecanor

  • Posts: 3867
  • Location: Stockholm, Sweden
  • Does not take bull****
Re: Dual-role modifier keys
« Reply #31 on: Tue, 10 September 2013, 06:49:54 »
to be honest it is not clear your idea to me.
As you know dual-role modifier basically handles a modifier(including Fn) and a normal key, it won't work on a combination of two modifiers like Alt and Fn. I couldn't get how to discriminate those Alt and Fn from your explain. Can you describe more actual example of keymap or layer you want to define?
I'm sorry, I had forgotten about this until a similar idea came up in another thread which reminded of this.

What I want is this:
If you press Fn-Tab, it should emit Alt-Tab.
However, for proper Windows-style Alt-tabbing to work, it should also support cases of holding Fn and pressing Tab repeatedly. The alt-tabbing panel should be visible for as long as you continue holding Fn.

What happens on pressing the Tab on the Fn layer is:
1. The Fn keypress is exchanged with an Alt keypress in the table of pressed keys. (Any firmware that supports multiple layers should store the full symbol and not just a bit in this table or it would not correctly support holding a key down while changing layers)
2. Both "Alt" and "Tab" are pushed on the event queue. (if your USB firmware just scans the table of pressed keys, this should not be needed ... but you would need an event queue of some sort to correctly handle the case when the number of pressed keys exceeds the interface's limit)
3. The current layer should revert to the layer it was on before the Fn key was pressed.
Smoking is assault. I defend myself.
Daily driver: Phantom (Lubed Cherry MX Clear, Lasered Cherry PBT keycaps with Row A. Plastic "Frankencase". Custom firmware, Swedish layout)

Offline Findecanor

  • Posts: 3867
  • Location: Stockholm, Sweden
  • Does not take bull****
Re: Dual-role modifier keys
« Reply #32 on: Tue, 17 September 2013, 19:56:46 »
About ordinary dual-role modifier keys (not the weird one I mentioned above):

Why is it necessary to have a delay?
Would it not suffice to just check if the key is used together with another key, or released after not having pressed another key?
Smoking is assault. I defend myself.
Daily driver: Phantom (Lubed Cherry MX Clear, Lasered Cherry PBT keycaps with Row A. Plastic "Frankencase". Custom firmware, Swedish layout)

Offline hasu

  • Thread Starter
  • Posts: 2757
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Dual-role modifier keys
« Reply #33 on: Wed, 18 September 2013, 00:19:52 »
Think of a dual-role key is comprised of Space and Shift.
 
When you type, for example, "a man" fast you will/may press 'm' before releasing space key.
Without the delay you will get "aMan" in this case.

If you release space key within the delay it registers Space, if not it works as Shift, my firmware does a job like this basically.
« Last Edit: Wed, 18 September 2013, 00:22:42 by hasu »
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline jalli

  • Posts: 101
  • Location: Toronto, Canada
Re: Dual-role modifier keys
« Reply #34 on: Wed, 18 September 2013, 20:22:19 »
I'm really happy this thread got revived, I've been thinking exactly along these lines for my new Global Ergodox Latin keyboard (Gelatin).

Basically I'm in a situation where I frequently need to use non-ASCII latin characters found in non-English Euro languages, switching between multiple layouts is a pain and I also want a Colemak style optimized keyboard, unfortunately AltGr+t+y is not a usable pattern to write in every other sentence.

Hence I started thinking about having the modifiers double as dead keys

Basically, shift would be a dead key for upper case (so that you don't have to hold it down while pressing the Alpha key)

Each of the other modifiers would become a modifier to allow characters such as to be written, same keyboard layout for all Latin character languages with a fully optimized pattern..

Example to sum up:

Ctrl Down is recorded, no signal is sent to the PC.
If another key is pressed before Ctrl is released, send Ctrl down and other key. any subsequent keys pressed/released are sent immediately including the Ctrl key being released.
If Ctrl is released without any other key press, send dead key scan code to PC.

Using modifiers as dead keys:
http://geekhack.org/index.php?topic=45211.msg1038689#msg1038689

I think this should work for Ctrl, Alt, Shift, on both sides, on top of this I also had an idea on how to change the legends on the keys depending on which dead key/modifier has been pressed:

RGB Led multi legends:
http://geekhack.org/index.php?topic=48584.0;topicseen
Antonia

Offline spiceBar

  • Posts: 996
    • ChessTiger.com
Re: Dual-role modifier keys
« Reply #35 on: Wed, 06 November 2013, 05:38:56 »
This thread is very interesting, and it looks like a lot of work and of thoughts went into making dual-role modifier keys work.

I would like to know about your success in using space as a dual-role modifier.

At this point, can space be used reliably as a dual-role modifier?

I'm thinking about a 60% layout where space would be used instead of a traditional Fn key. Space is especially interesting and important because this key is always under our thumbs, and pressing it does not require any "aiming". It's a big target so easy to reach, that you can effortlessly hold space while hitting any other key on the keyboard, even with just one hand.

Naturally we have the problem of space being used so often in normal typing that accidental rollover of space + any other key happens all the time. But apparently you guys have dealt with this issue.

Do you guys think it is realistic to use space as an Fn key, or am I just dreaming?

Offline Matias

  • * Commercial Vendor
  • Posts: 504
  • Location: Toronto
    • http://matias.ca
Re: Dual-role modifier keys
« Reply #36 on: Wed, 06 November 2013, 06:39:35 »
This thread is very interesting, and it looks like a lot of work and of thoughts went into making dual-role modifier keys work.

I would like to know about your success in using space as a dual-role modifier.

At this point, can space be used reliably as a dual-role modifier?


Fortunately, this is a solved problem -- by me :) 20 years ago.  Man, time flies. :(

Anyway, you can read all about it here, including a technical description of how to implement it efficiently in code...

http://edgarmatias.com/papers/hci96

Basically, any key can be used as a dual modifier/non-modifier, as long as you're willing to lose the auto-repeat on that key.

I used this technique to implement a one-handed keyboard, embedded in a standard keyboard, but the general concept is useful for other things.  Back then, I called it the "flip operation".  If you want to try it, there's a flash demo here...

http://matias.ca/halfkeyboard/demo

You'll notice that if you press the spacebar fast enough, you don't notice the lag.

The trick to this is having a timeout value that's not too long and not too short.  It needs to be long enough to give you enough time to press & release the key when you want the non-modifier, but short enough to not generate stray keystrokes when you want the modifier mode.  I found that a 267-millisecond timeout (~1/4 second) was the sweet spot.


I'm thinking about a 60% layout where space would be used instead of a traditional Fn key. Space is especially interesting and important because this key is always under our thumbs, and pressing it does not require any "aiming". It's a big target so easy to reach, that you can effortlessly hold space while hitting any other key on the keyboard, even with just one hand.

Naturally we have the problem of space being used so often in normal typing that accidental rollover of space + any other key happens all the time. But apparently you guys have dealt with this issue.

Do you guys think it is realistic to use space as an Fn key, or am I just dreaming?


Actually, I think the way hasu did it is perfect.  Use the right Shift key within the timeout for Up arrow, OR press & hold it for Shift.  Perfectly intuitive.

Nice work hasu!

« Last Edit: Wed, 06 November 2013, 06:48:49 by Matias »

Offline jalli

  • Posts: 101
  • Location: Toronto, Canada
Re: Dual-role modifier keys
« Reply #37 on: Wed, 06 November 2013, 09:35:20 »
I've been playing around with the tmk firmware quite a bit recently and it has the ability to do pretty much all of this, unfortunately I'm still waiting for my Ergodox kit from Massdrop so I can't test anything but once I have everything up and running I'll post some examples.
Antonia

Offline spiceBar

  • Posts: 996
    • ChessTiger.com
Re: Dual-role modifier keys
« Reply #38 on: Wed, 06 November 2013, 10:37:46 »
This thread is very interesting, and it looks like a lot of work and of thoughts went into making dual-role modifier keys work.

I would like to know about your success in using space as a dual-role modifier.

At this point, can space be used reliably as a dual-role modifier?


Fortunately, this is a solved problem -- by me :) 20 years ago.  Man, time flies. :(

Anyway, you can read all about it here, including a technical description of how to implement it efficiently in code...

http://edgarmatias.com/papers/hci96

Basically, any key can be used as a dual modifier/non-modifier, as long as you're willing to lose the auto-repeat on that key.

I used this technique to implement a one-handed keyboard, embedded in a standard keyboard, but the general concept is useful for other things.  Back then, I called it the "flip operation".  If you want to try it, there's a flash demo here...

http://matias.ca/halfkeyboard/demo

You'll notice that if you press the spacebar fast enough, you don't notice the lag.

The trick to this is having a timeout value that's not too long and not too short.  It needs to be long enough to give you enough time to press & release the key when you want the non-modifier, but short enough to not generate stray keystrokes when you want the modifier mode.  I found that a 267-millisecond timeout (~1/4 second) was the sweet spot.


I'm thinking about a 60% layout where space would be used instead of a traditional Fn key. Space is especially interesting and important because this key is always under our thumbs, and pressing it does not require any "aiming". It's a big target so easy to reach, that you can effortlessly hold space while hitting any other key on the keyboard, even with just one hand.

Naturally we have the problem of space being used so often in normal typing that accidental rollover of space + any other key happens all the time. But apparently you guys have dealt with this issue.

Do you guys think it is realistic to use space as an Fn key, or am I just dreaming?


Actually, I think the way hasu did it is perfect.  Use the right Shift key within the timeout for Up arrow, OR press & hold it for Shift.  Perfectly intuitive.

Nice work hasu!

OK, great!

Coincidentally, my question stems from thoughts I had last night following an answer to the thread you have started about the 60% form factor! :)

I have already tried to design 60% layouts, and I have even tested some (I have tested 6 of them by simulating them in software).

Some time ago I have posted what I thought was one of the best, but it was not very well received, because I had moved ONE character (the slash):
  http://geekhack.org/index.php?topic=47888.msg1023617#msg1023617

Now I have a design that does not move any character, so it allows touch typists to feel at home, and does not even use all the keys of a 60%.

I would be delighted to share this with you by PM or in a dedicated thread, assuming you have the time and interest for this.

Offline hasu

  • Thread Starter
  • Posts: 2757
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Dual-role modifier keys
« Reply #39 on: Wed, 06 November 2013, 11:59:55 »
Matias, Thanks for heads up!
I couldn't find that paper when I looked into your Half-Keyboard. Great resouce! and also historical :) I added it to first post of this thread. Again, I love your half-QWERY idea. Yes, one of reasons I needed dual-role function is to implement my version of Half-keyboard.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline Matias

  • * Commercial Vendor
  • Posts: 504
  • Location: Toronto
    • http://matias.ca
Re: Dual-role modifier keys
« Reply #40 on: Thu, 07 November 2013, 09:54:29 »
Matias, Thanks for heads up!
I couldn't find that paper when I looked into your Half-Keyboard. Great resouce! and also historical :) I added it to first post of this thread. Again, I love your half-QWERY idea. Yes, one of reasons I needed dual-role function is to implement my version of Half-keyboard.

Glad to help.  :)


Offline Matias

  • * Commercial Vendor
  • Posts: 504
  • Location: Toronto
    • http://matias.ca
Re: Dual-role modifier keys
« Reply #41 on: Thu, 07 November 2013, 09:59:23 »
Coincidentally, my question stems from thoughts I had last night following an answer to the thread you have started about the 60% form factor! :)

I have already tried to design 60% layouts, and I have even tested some (I have tested 6 of them by simulating them in software).

Some time ago I have posted what I thought was one of the best, but it was not very well received, because I had moved ONE character (the slash):
  http://geekhack.org/index.php?topic=47888.msg1023617#msg1023617

Haa, I can certainly sympathize.  We had similar outrage from some users when released a keyboard that had the Caps Lock replaced by Ctrl.  You can't please everyone.  :)


Now I have a design that does not move any character, so it allows touch typists to feel at home, and does not even use all the keys of a 60%.

I would be delighted to share this with you by PM or in a dedicated thread, assuming you have the time and interest for this.

I'm always interested in new ideas.  If you post it in a thread, you'll gave the benefit of others' feedback as well.


Offline spiceBar

  • Posts: 996
    • ChessTiger.com
Re: Dual-role modifier keys
« Reply #42 on: Thu, 07 November 2013, 18:16:27 »
Coincidentally, my question stems from thoughts I had last night following an answer to the thread you have started about the 60% form factor! :)

I have already tried to design 60% layouts, and I have even tested some (I have tested 6 of them by simulating them in software).

Some time ago I have posted what I thought was one of the best, but it was not very well received, because I had moved ONE character (the slash):
  http://geekhack.org/index.php?topic=47888.msg1023617#msg1023617

Haa, I can certainly sympathize.  We had similar outrage from some users when released a keyboard that had the Caps Lock replaced by Ctrl.  You can't please everyone.  :)


Now I have a design that does not move any character, so it allows touch typists to feel at home, and does not even use all the keys of a 60%.

I would be delighted to share this with you by PM or in a dedicated thread, assuming you have the time and interest for this.

I'm always interested in new ideas.  If you post it in a thread, you'll gave the benefit of others' feedback as well.

OK, I'll post it in a new thread and brace myself for the outrage. :)

Offline jeffgran

  • Posts: 126
  • Location: Denver
Re: Dual-role modifier keys
« Reply #43 on: Sun, 17 November 2013, 15:29:37 »
This thread is very interesting, and it looks like a lot of work and of thoughts went into making dual-role modifier keys work.

I would like to know about your success in using space as a dual-role modifier.

At this point, can space be used reliably as a dual-role modifier?


Fortunately, this is a solved problem -- by me :) 20 years ago.  Man, time flies. :(

Anyway, you can read all about it here, including a technical description of how to implement it efficiently in code...

http://edgarmatias.com/papers/hci96

Basically, any key can be used as a dual modifier/non-modifier, as long as you're willing to lose the auto-repeat on that key.

I used this technique to implement a one-handed keyboard, embedded in a standard keyboard, but the general concept is useful for other things.  Back then, I called it the "flip operation".  If you want to try it, there's a flash demo here...

http://matias.ca/halfkeyboard/demo

You'll notice that if you press the spacebar fast enough, you don't notice the lag.

The trick to this is having a timeout value that's not too long and not too short.  It needs to be long enough to give you enough time to press & release the key when you want the non-modifier, but short enough to not generate stray keystrokes when you want the modifier mode.  I found that a 267-millisecond timeout (~1/4 second) was the sweet spot.


I'm thinking about a 60% layout where space would be used instead of a traditional Fn key. Space is especially interesting and important because this key is always under our thumbs, and pressing it does not require any "aiming". It's a big target so easy to reach, that you can effortlessly hold space while hitting any other key on the keyboard, even with just one hand.

Naturally we have the problem of space being used so often in normal typing that accidental rollover of space + any other key happens all the time. But apparently you guys have dealt with this issue.

Do you guys think it is realistic to use space as an Fn key, or am I just dreaming?


Actually, I think the way hasu did it is perfect.  Use the right Shift key within the timeout for Up arrow, OR press & hold it for Shift.  Perfectly intuitive.

Nice work hasu!

Thanks for posting this, Matias. This is a really great idea, and the opportunity to try it instantly with your flash demo lets you see how easy it really is and how well it works. I think I'm going to try to get this working (space, backspace, enter all as dual mod keys) on my ergodox. :)

Offline Matias

  • * Commercial Vendor
  • Posts: 504
  • Location: Toronto
    • http://matias.ca
Re: Dual-role modifier keys
« Reply #44 on: Sun, 17 November 2013, 15:49:19 »
Thanks for posting this, Matias. This is a really great idea, and the opportunity to try it instantly with your flash demo lets you see how easy it really is and how well it works. I think I'm going to try to get this working (space, backspace, enter all as dual mod keys) on my ergodox. :)

No problem.  :-)

BTW, while one-handed typing is very cool, I found that replacing Caps Lock with an Fn key (and a well designed Fn layer) is a lot more useful in day-to-day use...

http://matias.ca/optimizer

http://matias.ca/optimizer/viewer/?p=5

The Backspace, Enter, Copy/Paste shortcuts on the left hand are expecially handy.


Offline lydell

  • Posts: 42
  • Location: Sweden
Re: Dual-role keys
« Reply #45 on: Sun, 15 December 2013, 03:26:49 »
Now there's been yet another two months since my last post. Here are some more experiences with my modifiers on the home row experiment.

During most of the past two months, I've absolutely loved it. I've had to update my AHK script a few times though, to be able to tweak some things after a while. That's a downside of it: It requires a lot of fiddling to get it right.

However, the last week or so, it feels like I've hit the limit. Now, it is slowing me down. I trigger control shortcut keys way too often while typing, and sometimes the text gets all garbled up because of all timeouts and stuff.

So I've come to the conclusion that there are three things I like about modifiers on the home row:

* The pinky does not have to do everything.
* It's very easy to use multiple modifiers at the same time, since each modifier has its dedicated finger.
* They're always within reach.

I've now decided to ditch the last point, in favor of faster typing speed, by moving the dual-role modifiers two steps up to the number row. That's gonna be a bit longer reach, but the two other benefits remain. The experiment goes on...

During this time, I've also made space and enter into dual-role keys. I haven't had any problems with them, though. I think that the conclusion is that you shouldn't make character keys into dual-role keys.

Offline angelic_sedition

  • Posts: 124
  • Location: Flatland
Re: Dual-role keys
« Reply #46 on: Mon, 10 February 2014, 22:34:42 »
Too bad there is no good implementation on linux. For simple modifier to something on key release i.e. escape on caps tap, there's xcape (and similarly keydouble and space2ctrl), however there is no program that perfectly deals with with using "normal" keys as modifiers. The closest is AHM which at least tries to do something about accidental presses, but I had to stop using it because it doesn't work perfectly. If anyone knows of another solution while I try to get tmk firmware running, I'd be happy to hear it.

My conclusion is not that character keys shouldn't be made into dual role keys; I think they are the best candidates. I think a hybrid chording system has a lot of potential. With enough easily accessible thumb keys, I probably wouldn't use more than 1 or 2.. 4 max probably. In the past I've used qwerty d to access my nav/misc layer (things like backspace, arrows, a few symbols, tmux prefix key, etc.) and spacebar for window management, launching most used programs, and my most important hotkeys. I wonder how well remapping shift to a letter on each side would work. As for modifiers as normal keys, I only ever do escape on release.
QWERTY(104wpm) -> CarpalxQ(modded) -> Colemak(118wpm) -> Colemak-DH
Mouse less.

Offline plainbriny

  • Posts: 186
  • Location: Taiwan
Re: Dual-role keys
« Reply #47 on: Tue, 11 February 2014, 00:12:40 »
My use of dual role keys:

1. space as shift: we usually don't press space and shift at the same time, this setting helps to keep my hands on the home row

2. f used to activate navigation layer: I have a layer in which the right hand home row keys are assigned to navigation keys, since we seldom use characters and navigation keys (arrow keys) in combination, this setting allows me to keep my hands on the home row all the time 

I have been using tmk firmware for a couple of months, this firmware is amazing. I will never consider non-programmable keyboards again.

Offline spiceBar

  • Posts: 996
    • ChessTiger.com
Re: Dual-role keys
« Reply #48 on: Tue, 11 February 2014, 06:42:23 »
Too bad there is no good implementation on linux. For simple modifier to something on key release i.e. escape on caps tap, there's xcape (and similarly keydouble and space2ctrl), however there is no program that perfectly deals with with using "normal" keys as modifiers. The closest is AHM which at least tries to do something about accidental presses, but I had to stop using it because it doesn't work perfectly. If anyone knows of another solution while I try to get tmk firmware running, I'd be happy to hear it.

My conclusion is not that character keys shouldn't be made into dual role keys; I think they are the best candidates. I think a hybrid chording system has a lot of potential. With enough easily accessible thumb keys, I probably wouldn't use more than 1 or 2.. 4 max probably. In the past I've used qwerty d to access my nav/misc layer (things like backspace, arrows, a few symbols, tmux prefix key, etc.) and spacebar for window management, launching most used programs, and my most important hotkeys. I wonder how well remapping shift to a letter on each side would work. As for modifiers as normal keys, I only ever do escape on release.

I have tried to implement SpaceFN in Linux using the record extension in X11.

Trouble is, it lets you intercept key presses, it lets you add keys to the event queue, but you cannot remove events from the queue!

So it works only for real modifiers. A modifier like Shift generates 2 events when you press then release it, and these events are ignored. When you detect the key release, you can then add an event to the queue (if no other key has been pressed in between). That's how xcape works.

It does not work for keys that generate a character, because you cannot remove this character from the event queue.

I don't know how to do better than that. Apparently if you want to be able to modify the event queue you will need to modify one of the Linux kernel drivers.

There is an utility called AutoKey that does key remapping, but it is buggy (it often crashes when you keep a key pressed) and apparently it works by dealing with the window manager, so it's not very portable and this approach suffers from other shortcomings.                       

Offline Pro XKB

  • Posts: 25
Re: Dual-role keys
« Reply #49 on: Tue, 11 February 2014, 12:59:37 »
> Trouble is, it lets you intercept key presses, it lets you add keys to the event queue, but you cannot remove events from the queue!

How about using ActionMessage:

http://geekhack.org/index.php?action=post;topic=41685.30;last_msg=1223995