Please help me with merging (and understanding) two macros

I have two simple macros. By chance, I discovered that they do something together that is very useful to me. (Even though I don't understand how they do it).

Anyway, the result is: Space behaves like a modifier. For example, if I press space + R, nothing is typed, (not space and not R) but something can be triggered.

My questions: Is it possible to combine these macros? Or maybe simplify them? Or is there maybe an easier way to achieve this behavior with Space? Many thanks in advance :slight_smile:

Macro 1.kmmacros (2.3 KB)

Macro 2.kmmacros (2.6 KB)

If they work fine, what's the issue? Combining would probably just make things more complex. Do you want things to be complex for some reason?

Your second macro is triggering in an infinite loop whenever the R key is pressed. Is that really want you want?

In my opinion (it's just my opinion) you should explain what you are trying to do before asking for help coding it. Because you might be solving it the wrong way. Specifically, I would like to know why you need to simulate a Space as a modifier. And I would like to know what app you are running while these macros are enabled, because I'm worried about the repeating R messing up your app.

I want to help, but I have to ask skeptical questions.

Thank you @Airy You can always ask whatever you want.

But I thought these questions were already answered, at least implicitly.

These macros are so ... absurd that I thought you could just merge them. If not, then not.

I don't notice that.

Isn't that what many people want? Because it's practical and space is large and easily accessible.

Many. Writing apps, browsers ..

As I said, I don't know what you mean. But I'm a KM ignorant, so forgive me (I'm more into BTT). I tried this for an hour and it worked fine.

As @Airy is saying surely that isn't what you want? If you are getting some result from that second macro there must be something else going on. I found using a key press without a modifier key as a 'hot key' to be a very bad idea, though obviously something is going on with your macros that isn't apparent from what you have shown us?

I have no idea what you mean. The two macros do exactly what I said. Unless I hadn't noticed something yet.

Space + R doesn't type anything (so seems safe) and can trigger something. :man_shrugging:

Download the macros and try it out. Nobody will die :wink:

The point is, if you want to replace a modifier with another key, it always types something you don't want. Not here, as far as I can tell. But since I don't understand any of this, I'd better ask.

I've never heard of anyone who wants to use Space as a modifier key. I'm not sure if KM can accomplish that (it might be possible if you are willing to use a long press as a modifier but a short press as a Space key.)

I believe the utility called K-E can use the Space key as a modifier for a long press but a Space for a short press.

I believe that programmable keyboards that support QMK or VIA software will be the most reliable way to solve this problem.

I need to apologize for making a mistake. There are three triggers that I sometimes confuse with each other: pressed, down, and tapped. You were using pressed and tapped, but not down. Therefore there is no infinite loop. I'm sorry for being wrong.

I'm still confused by your macros because they actually don't do anything when both Space and R are down (other than display a pop-up in one macro.) So I don't get the point of the macros.

@Airy, you always helpful friend :slightly_smiling_face:, this “pop-up” is a placeholder for any action that can be triggered. I don't know how to explain it more clearly, space + letter doesn't type anything, but can trigger something, at least that's what it looks like to me. It's like pressing cmd + letter.

Good, then we don't live in the same universe. Where I come from, a lot of people want that.

I'll summarize, I don't understand the macros, others obviously don't either. But they do something extraordinarily useful ... from the point of view of some.

Edit: Perhaps my explanations are indeed completely incomprehensible, but if anyone understands what I mean, I would be grateful for any suggestions.

Okay, since they are useful, and they work, and there's nothing wrong with them, then just use them as they are. There's no need to merge them.

Looking at the logic (i.e. this is totally untested!) you should be able to make one macro that has both those triggers, then test the trigger value and do either "Macro 1"'s actions or "Macro 2"'s:

Combined.kmmacros (6.5 KB)

Image

It is also possible to do that in Karabiner Elements. (I did so for a while back in the days when I had one of those weird old-fashioned keyboards that have space bars. :stuck_out_tongue_winking_eye:).

That is something that I have explained to @Frankb a few times, so I can only guess that he has his reasons for not going down that path.

(Strictly speaking: QMK is the firmware that runs in the programmable keyboard; VIA is software that provides one way to edit the key configurations that will be flashed to the keyboard as part of the firmware).

1 Like

Thanks @Nige_S , that works as expected.

Yes, you did :slight_smile: and I thought about it. Another keyboard is out of the question for various reasons and I want to avoid another app that I don't understand, like Karabiner.

Using Space as a modifier is as appealing as it is complicated. A key can either be down or up. There are apps that try to simulate a state in between. This works mediocre and creates problems when typing quickly.

I am testing various possibilities under the conditions I have given myself. I'm the one who still wants to invent perpetual motion, even though I've been told 1000 times that it's not possible :joy:

1 Like

Spacebar as a modifier

Ok, not that anyone would be interested, so I'll keep it short :slightly_smiling_face: I think this is how it could work with KM.

  • Spacebar, tirgger “is tapped”, activates the macro group “2nd function” if space is held.

  • In the macro group “2nd function” is a macro that opens Safari with “s”, for example.

  • If space is released, the macro group is deactivated and "s" is "s" again.

Perhaps it is possible in this way that space + s opens Safari?