franciscolourenco / octopus

Swift 5 implementation of Karabiner's Homerow and Tab modes
5 stars 2 forks source link

Is this system capable of true home row mods without a Space layer? #5

Open eugenesvk opened 11 months ago

eugenesvk commented 11 months ago

I saw your desription of a better non-timing-based design for home row mods in https://github.com/yqrashawn/GokuRakuJoudo/issues/158#issuecomment-1025209574 and finally decided to try it, but discovered (unless I missed something) that the home row mods are behind a Space layer, which is rather inconvenient

Is it possible to have true home row mods without a Space layer that wouldn't interfere with typing using your key-up-order system instead of timings? (currently it's partially possible in Karabiner, it doesn't interfere with fast typing, but still based on delays, so you need to hold a home row f a bit for it to turn into )

franciscolourenco commented 11 months ago

@eugenesvk in this implementation, homerow mode is enabled while the space key is pressed and held down. How are you looking for to enable homerow mode?

eugenesvk commented 11 months ago

Just by launching the app! The beauty of homerow mods is that they offer the best convenience, and adding an extra prefix kills that, especially for ⇧ Caps that use the ⇧ just once per key

franciscolourenco commented 11 months ago

I'm not sure if I understood correctly - you would like to toggle homerow mode on and off by opening and quitting the app?

eugenesvk commented 11 months ago

Yes, but I think the confusion stems from "toggling" - the app would be always running, so the home row mods will be always active. I don't need to "toggle" anything, just launch the app and have it working just like I have currently with Karabiner Elements

franciscolourenco commented 11 months ago

So, how would you type normal text? You need a way to enable and disable the mode right?

eugenesvk commented 11 months ago

You type normal text as usual? The home row mods only activate the modifiers on hold (e.g., f for ) , so they don't affect your regular typing in any way. Just like your space key supposedly doesn't interfere with regular typing, right?

So if you press sequence of f then i and:

With Karabiner you can achieve fi if i follows f within 0.x seconds, so that has close to no interference with regular typing (and you don't need to change your style to avoid longer holds of f), but that means you still have to hold f for longer than a timeout to activate the hold, so the mod part is still less than ideal

franciscolourenco commented 11 months ago

In this implementation, the space key is equivalent to f in your example. If the space key is released before i is released it sends a space keystroke and then a i keystroke. If the space key is not released before i is released, i sends instead an up keystroke.

eugenesvk commented 11 months ago

The equivalency is the point of this issue: just instead of activating home row mods indirectly via space you'd activate them directly with home row keys

By the way, can this Swift code be "generated" from loading a config file at runtime to have something like

for ($key_in, $key_out) in $keys from "/config/file.cfg" {
   KeyEvent(key: $key_in, modifiers: []): KeyEvent(key: .$key_out, modifiers: []),
} // ↑ loop instead of a bunch of hardcoded lines ↓
   KeyEvent(key: .i, modifiers: []): KeyEvent(key: .upArrow, modifiers: []),

(in reality this would also have modifiers, but just simplifying)

and similarly the mode definition itself

            trigger: KeyEvent(key: .space, modifiers: []),
franciscolourenco commented 11 months ago

Instead of space, you could change the code to use whichever trigger keys you prefer, including homerow keys.

Loading the config at runtime is not supported with this app. There might be a way to do it, but I don't know how. If there was a way to implement this logic in Karabiner it would be ideal, but last time I'v tried, I didn't manage to.