Consuming Keystrokes in BTT - Using as an alternative to TouchCursor


#1

For years on my windows systems, I've used a tool called TouchCursor (https://martin-stone.github.io/touchcursor/). In brief, this lets you pick an activation key (by default SpaceBar) then remap other keys on your keyboard.

For example, SpaceBar plus the letter I instead triggers a Cursor Up movement. SpaceBar+K triggers Cursor Down. Similarly, SpaceBar+J and SpaceBar+L are cursor left and right.

This is great as it lets me move the cursor around in my current document, or scroll web pages up and down without taking my keys off the "home row" position of the keyboard. You wouldn't believe how much faster you can type using this.

I've tried to emulate this using BTT, but with limited success. The problem with BTT is that it still lets the keystrokes through, then uses either CTRL+Z or two backspaces to remove the characters.

While visually distracting, it's not horrible in a text document. However, in other places, it can have unintended consequences.

Is there a way in BTT I can tell it not to let the keystrokes through, and instead just replace them with the replacement key? I.E. don't let SpaceBar+I in and replace it with a Cursor Up? I tried but couldn't figure out a way.

If not, does anyone know of a tool that might be able to do this?

I will add I've been a Better Snap Tool user for quite some time, and it is on my short list of indispensable Mac apps.

Thanks


#2

I don't really understand how this would work.
Wouldn't the spacebar type a space first if you use it as activation key? Or how would you type " j" or " l" then?


#3

It works just like the Command, Control, and similar keys.

I believe, and this my understanding from e-mails with the author a few years ago, his site probably has a better explanation, that TouchCursor monitors the keyboard buffer in Windows. It sees the SpaceBar has a keypress down event, but the key up event hasn't come thru.

If it sees that condition, then it sees there is a keypress down followed by a keypress up event for the letter I, it throws away the I and replaces it with a cursor up. At the same time it sets a boolean flag to say "I've been triggered".

It repeats this, reacting to other key down/up events such as J, K, L, until the SpaceBar key up event occurs. If the "I've been triggered" flat is set to true, it throws away the keypress for the SpaceBar.

If the "I've been triggered" flag is false, in other words, it saw a key down event for SpaceBar immediately followed by a key up event for SpaceBar, then it lets the space character through.

Does that clarify it? The site for TouchCursor may provide a better explanation. You can also download the source code as he made it open source. It hasn't been updated in a few years now but continues to work perfectly.

I'm not sure if this is even possible on macOS, I know a bit about Windows programming but haven't done any work on macOS development.

Thanks for your quick reply.


#4

Mhm by default on macOS the space bar triggers already on key-down.
This could be blocked but I wonder how key repeat would then work. (Holding space to produce multiple spaces)