Spacebar Can Act Like Command Key

I discovered something very useful for me, it might be useful for somebody else too.

With Keyboard Maestro (KM) and Bettertouchtool (BTT) you can create a „new modifier“. No remapping, no hyper keys.

With BTT the „Spacebar“ can act like the modifier Command (or Option or Control). Any shortcut that works with „Command + letter“ works with „Spacebar + letter“. To do this BTT uses „Key Sequences“ which is similar to „string is typed“ in KM.

Let’s say you want to open Safari with den shortcut „Spacebar + s“. In BTT go to „Key Sequences“ and record the following. To work best it should look exactly like that:


(„Leertaste“ = „Spacebar“)

Then assigne launch Safari to „Spacebar + s“.

Now any time you press and hold the Spacebar, you press and release „s“ and at the end you release the Spacebar Safari will be launched.

if you don't want to bother how long you can press Spacebar, before the cursor moves, do this in KM.


Now while Spacebar ist pressed and hold nothing happens. You have time to choose a letter. Alternatively you can change your keyboard’s response speed. But this will affect also other keys, not only Spacebar.

The Spacebar „modifier“ works perfectly. You have the whole alphabet to define new shortcuts. Interference with normal typing of text is almost impossible, because you would not type „s“ while Spacebar is pressed.

If you like shortcuts but you are running out of modifiers or you don’t like impractical caps lock hyper keys, then the Spacebar „modifier“ is the best and most intuitif way to solve the problem.

It's just a suggestion :slight_smile:

2 Likes

Sorry...

To work best it should look exactly like that:

if you don't want to bother how long you can press Spacebar, before the cursor moves, do this in KM.

That a very interesting idea.

But you've got me wondering if someone can write a macro in KM that can do the same thing without BTT.

I was hoping someone would ask that.

When I'm more awake I might try that. It seems possible.

The reason why it might not be a popular macro is that it will cause the space bar to not actually trigger a space key until after the space bar is released. I'm not sure people would tolerate that behaviour.

yes, that is also the case with my "solution". The difference is hardly noticeable while typing text.

I'm not sure if it will be "hardly noticeable" until I've written the macro. Here's how I see it being done.... We will need to write one macro that is triggered when the Space key is pressed. We will need another key that is triggered when the space key is released. We will need a third macro to trigger when a keyboard key is pressed. This third macro will "simulate the erasure" of the keyboard key before deciding if it should press a command key in its place or if it should allow the original keystroke. At this point I can't tell if the erasure will happen so fast that you won't see it.

We may also need a fourth macro to capture the space key itself, but I don't think so.

I have a feeling you would be able to see the "erasure" occurring, so I don't think you would be happy with my solution. So at this point I'm inclined not to write it. But I'll reconsider after lunch.

Ok, you're the expert. Thank you if you decide to try :slight_smile:

That's one of two possible approaches I'm pondering. The other approach is to create a macro that turns every keyboard key into a hotkey. I've always wanted to do that.

I am happy that you are interested in this "problem". The "Modifier" spacebar is so interesting because it is always under your thumbs...

Okay, I have my first prototype working. On my M1 Mac, (your results may differ on another Mac) you can see a visual glitch about 50% of the time because KM doesn't seem fast enough to erase the key before it's seen by the user. As such, I implemented it only with CMD-A, CMD-B and CMD-C as part of my testing phase. It would be possible to make it work with ALL the command keys, even without using a SWITCH statement, but since nobody wants a visual glitch, I'm going to switch and try approach #2 instead. If the results are better with approach #2, we'll finish that approach instead. I'll attach my solution #1 to this message in a minute, which you can see and reject as you see fit. It may be useful/educational to see how I did it, even though the macro is a little incomplete.

But this solution raises a question that you haven't answered. How do you want keys like SHIFT-COMMAND-C to be handled? Do you want the SpaceBar to work with those multi-modifier keys, or just with single modifier keys? If you want multi-modifier support, I still think I can do this, (and I was planning to do this before your post) but it will take some AppleScript, which means it will take me days to figure out.

Here are my four macros for attempt #1 which technically work but don't work fast enough to be pleasing.

Spacebar Macros (v10.0.2)

Spacebar Macros.kmmacros (15 KB)

Thank you :slight_smile: I will try it as soon as I can.

Multi-modifier: Who needs that? If I can use (with one Hand) Space+letter, Command+same letter, Control+same letter for for different tasks, this is perfect!

If you don't need multi-keys, then it should be easy for anyone to modify the example I posted above and make it work. However, as I said, that solution has a visible glitch that's unpleasant to watch on an M1 Mac. Maybe on the new MacBook Pros it might work so fast you won't see the glitch.

As I said, that was a prototype. It was barely tested. If you find something wrong, let me know. I'm pondering solution #2 at the present time.

IMPORTANT: I forgot to mention that my solution #1 is configured right now to work only in the TextEdit app. This was done so I could test it without interfering with the KM Editor.

ALSO IMPORTANT: I've got solution #2 prototyped, and while it's incomplete, and has at least one bug (i.e., it always inserts uppercase instead of the correct case), it shows that in theory it can be made to work. There is no visual glitch using this approach, so it's a much more viable approach to your problem. I'll post the macro group here in a moment...

SpaceModifier Macros (v10.0.2)

SpaceModifier Macros.kmmacros (11 KB)

Also, it only works with TextEdit at the moment to help me avoid conflicts with KM Editor. Also, it only handles COMMAND-A to COMMAND-E at the moment. This can be fixed, and it can even be fixed without using a Switch action at all, but it was done just to see if I could get it to work.

I'll ponder both of these approaches for a while, and will probably enhance #2 to make it work with all keys and in all apps. I have tricks up my sleeve that can probably make #2 work really well.

I will need a moment to try and understand that. Then I will tell you how it works for me. Anyway, You are my hero!

These macros are prototypes only to test and illustrate their potential, but if you can modify them to make yourself happy, so much the better.

I need to do some errands now. I'll probably consider them again tonight.

Interim report: solution #2 SpaceModifier Macros.kmmacros (11 KB) seems to work very well (Just uppercase, as you said). „Space + a“ is very fluid. BUT: the Spacebar alone unfortunately has lost its function. No space.

I thought I tested that. It was supposed to work. Let me look again. Yes, I forgot about the space. I can fix that. There's more than one way to fix it.

Sure, take your time. I am surprised that nobody else is interested in Spacebar "modifier"...

Here's version 2. It fixes the problem that I forgot to support the space key. It does not yet fix the problem of lowercase/uppercase, but try it out. It still works only from CMD-A to CMD-E. It could be significantly enhanced and made without a SWITCH action, but try this out anyway and see if it's a decent prototype. I'm still not finished my errands before I come back this evening.

SpaceModifier v2 Macros (v10.0.2)

SpaceModifier v2 Macros.kmmacros (13 KB)