How to map modifier keys to mouse buttons?

Hey all, I'm looking to make my mouse's scroll left / right into CMD / ALT. This can be achieved via Logitech's app, but I want to keep everything within BTT for the sake of organization. Keyboard inputs in BTT only accept the combination of a regular key+modifier and BTT preset actions only have the option of either doing modifier down or up.

I need the modifier to remain active (pressed down) until I release it. Any way I can achieve that? Many thanks.

Maybe it works like this

That’s what I meant with the preset actions only allowing for up or down. Maybe I am missing something ? How would I go about setting this up so the mouse key behaves like a regular modifier key?

Mhh, I have no experience with it because I don't have a mouse.

But probably you need two actions set up with these actions

  1. mouse button pressed and hold = modifier down

  2. mouse button released = modifier released (Up).

This is what the manual says

Trigger on key-down / key up

BetterTouchTool allows you to select whether you want a shortcut to trigger on key down or on key up. This can be useful if you want to e.g. trigger one action on key down (e.g. middle-mouse down using the custom click predefined action) and another action on key up (e.g. middle-mouse up).

In such a case you would just configure two shortcuts with the same keys. Then you would check the "Trigger on down" checkbox for one of them.

I tried this but the modifier gets permanently stuck and I have to force quit BTT.

1 Like

Did you copy/paste an action and then change the modifier up/down? Or did you delete a modifier that you inserted by mistake? I don't know why, but that often doesn't work.

Delete both actions and set both up again. Sometimes this helps. :man_shrugging:

Indeed I had duplicated it before, but I tried again just now all manual in one straight go and I am getting the same behavior - modifier will not release on key up :confused:

I thought maybe I was just using these in the wrong way, but as you pointed out in the documentation, this is pretty much the exact example given. I suppose this is a bug then.

Franks solution is correct but incomplete. I think your problem is because whatever action you trigger with it held is interrupting the logic and the "up" does not fire.

You should be able to solve this by adding an additional "[Modifier] Up" action to whatever trigger(s) you you are firing while the modifier is held.

Hi @anon can you please explain this a bit more precisely. You mean it needs an additional "up" in the same action where you have "down"?

I did not have an additional trigger running concurrently (unless automated triggers from scripts running in the background count). The idea here is to be able to press the scroll wheel left or right and hold it while scrolling. So the end result would be ALT+Scroll Up/Down or CMD+Scroll Up/Down.

This is useful for many different softwares, including 3D software where there is heavy reliance on Scroll Wheel + Modifiers to navigate scenes.

Oh scrolling is going to be difficult... Because each notch of the scroll wheel is a separate input AFAIK.

I'm now also second guessing if I was even thinking of the right situation even remotely.

What I was referring to was essentially like mapping a hyperkey in certain situations. Essentially I've ran into things before where I wanted to assign an arbitrary key to a modifier key, where whatever trigger I was then activating with said false modifier key would also need an modifier key "up" to conclude the action without that modifier getting stuck down.

@Frank1

Mm, It may be me, but I have no idea what you mean, you just repeated what you have said before. :man_shrugging:

Sorry, it's not you. I'm clearly struggling to put the concept into trigger-agnostic terms so I'll just give you a concrete example from personal experience instead.

I wanted Mouse Button 3 to act as CTRL+ALT+CMD+SHIFT, a sort of custom hyperkey if you will. I wanted the ability to trigger actions merely from a Left Click or a Right Click which would each require all of those same modifiers.

So I first created the following triggers and actions:

MB3 (on down) = CTRL(down) + ALT(down) + CMD(down) + SHIFT(down)
MB3 (on up) = CTRL(up) + ALT(up) + CMD(up) + SHIFT(up)

Left Click (Requiring CTRL+ALT+CMD+SHIFT) = Move Left a Space

Right Click (Requiring CTRL+ALT+CMD+SHIFT) = Move Right a Space

This got as far as triggering the Left Click or Right Click actions, but then upon releasing the button combination I was stuck with CTRL, ALT, CMD and SHIFT all in the down position. Obviously, pretty big problem...

The solution that actually worked was a modification of the above to the following:

MB3 (on down) = CTRL(down) + ALT(down) + CMD(down) + SHIFT(down)

MB3 (on up) = CTRL(up) + ALT(up) + CMD(up) + SHIFT(up)

Left Click (Requiring CTRL+ALT+CMD+SHIFT) = Move Left a Space + CTRL(up) + ALT(up) + CMD(up) + SHIFT(up)

Right Click (Requiring CTRL+ALT+CMD+SHIFT) = Move Right a Space + CTRL(up) + ALT(up) + CMD(up) + SHIFT(up)

That said, while the above did work, I ended up scrapping it in favor of a conditional logic approach. I did a little write up on the solution I settled on which you can check out here: Mouse Chords: How to Use a Mouse Button Click as a Pseudo-Modifier for Complex Mouse Inputs WITHOUT Karabiner, SteerMouse, Maestro, Etc

2 Likes

Ok, thanks for explaining :slight_smile: Now I understand.

In summary, after the action you wanted to perform, you additionally set all modifers to "up". Although that shouldn't be necessary, because they should already be on "up" by releasing the button.

If the modifiers were already "up" a second time would not hurt. And if they were still "down", the second command corrected that.

That's clever, I will try that :grinning:

1 Like

Your blog post describes a robust and elegant method. Thanks for posting it.

1 Like

Thanks for saying so! That post got zero engagement, so kind of felt like a waste of time. But, I am very glad to now know at least one person found it useful!