How to Use Mouse Buttons as Modifiers?

Hello all!

I'm on MacOS Ventura and have a Logitech MX Master 3s. I've also installed rcmd which basically lets me switch to certain applications quickly with key combinations (for instance, Right Ctrl + F opens Finder). Now, I'd like to use KM to make the right click (button 2) as Right Ctrl or another modifier so I can quickly switch between applications with a right click and a letter. How can I accomplish this?


I don't know because I don't use a mouse. But the same result with a different procedure, provides this.

Press the mouse button you want to open eg this palette.


Now press "a" to switch to app a, or "b" etc to switch to another apps. After pressing the letter the palette disappears by itself (show for one action).

If you don't want to, you don't have to notice the palette at all. It can be shriked in a corner of your screen.


As a result, you press the mouse button, (which works like a kind of modifier), and then a letter of your choice.

PS: What should also work is an AppleScript. However, my experience is that this does not work reliably.

I hope I'm not telling you nonsense. :innocent:

KM isn't really the best tool for this kind of thing. Have a look at Steermouse.

1 Like

Well, if it's about recommending another app, then I would say: Have a look at BTT :smirk:

1 Like

That's a good thought, Frank. But would this be the Application Palette or the Global Macros Palette? I can set the palette to show on mouse down and hide on mouse down, but I'm not sure how to assign applications specific hotkeys on the application palette. Also, wouldn't this conflict with keypress events associated with the currently active application itself?


Steermouse doesn't seem to let me target specific modifiers. It applies modifiers to mouse buttons generically, so I can't choose a right Control key specifically, say.

you use the mouse driver for applying modifier key mouse buttons.
or use karabiner elements.
and after you can set macros in keyboard maestro.

Uf, to explain that exactly brings me to the limits of my English. :hot_face: It is a "normal" palette that can be global or app specific. The triggers (hotkeys) are assigned directly to the macros.

No, otherwise it wouldn't make sense. When the palette is "visible", "a" is not "a", but switches to "app a". (In this example)

You don't have to hide the palette by mouse. It hides itself after you press the trigger, eg "a". Choose "show for one action".

You're conflating different things -- there are "Right-Control" and "Left-Control" keys, but there is only one "Control" modifier.

To do this directly you are going to have to use something that can remap a mouse button to a key. If the Logitech software doesn't do that, try Karabiner Elements. Then all you have to do is map the button to Right-Control and, with luck, that plus a letter will be recognised by rcmd.

@Nige_S Just a question so I understand. Even if Karabiner can distinguish between right and left modifiers. KM can not do that. So if a shortcut is triggered with KM, isn't it triggered with both modifiers?

As I understand the OP, he wants to try and either use KM to "mouse button and letter" to switch apps in the same way as he does now with rcmd, or use KM to "redirect" the mouse key so it acts as Right-Control which in combination with a pressed letter key, will trigger rcmd to switch apps.

I don't think either are possible. As you say, KM can do a Control modifier but not a Right-Control keypress, while (I believe) an "USB Device Key" trigger is a single event so you couldn't include another key. (You might be able to do "USB Device Key" and start a macro that waited for a "pressed key change" if you could a) swallow the key that changed, and b) use the value in another action, but I don't think you can.)

Even if you can do any of the above it just seems to be layering on complexity and, therefore, the chance of error. Much simpler to remap the mouse button to Right-Control in the driver or with Karabiner and just use rcmd as he is right now.

Thank you @Nige_S . I think slowly I understand. At the moment he does everything with the Logitech software. Both defining the left/right modifier and setting up the shortcuts. Right? But that shouldn't work either. Suppose he uses (Logitech) rcmd+F to switch to the Finder. If he uses cmd+F for "something else" with KM, then this "something else" is triggered with the left and the right cmd modifier. Which inevitably leads to conflicts. Or not?

The distinction between left and right only makes sense if an app allows to trigger different actions with left/right cmd+F. As far as I know, only BTT can do that.

But he wants to use KM. That's why my idea was not to use modifiers but a palette. The "handling" is identical. Press mouse button (palette becomes visible) + F = switch to Finder (palette disappears). This works and is conflict free because he can use any letter regardless of already existing shortcuts.

A valid alternative would be a conflict palette, because it is easier to set up. And if he does it wisely, he can choose the trigger freely, even if conflict palettes don't actually allow that.

No. At the moment OP uses the keyboard, but wants to use the Logitech button in place of the Right-Control key.

I think (and I'm trying not to put words in OP's mouth!) that he wants to be able to switch apps using "mouse button and letter key" in the same way he currently does with "Right-Control and letter key". He thinks he should use KM to do this, which is why he'd "like to use KM" -- I believe it would be much simpler to remap the mouse button to the Right-Control key and carry on with the software he's already using.

I do like your way of doing it, in KM either via a Palette or Conflict Palette, but that turns it into a two-step operation rather than the one-step rcmd functionality he has now.

You're right, Nige. I'm a designer and I use my mouse (the MX Master 3s) right-handed. I want to be able to switch to specific apps swiftly with specific key combinations (via one key using my left-hand that stays on the keyboard) combined with a modifier (right-handed, via the keyboard or mouse depending on where my hand is).

I use rcmd to assign Right Control as my modifier so I can still use the other Left Control key normally - and that works well. Unfortunately, Karabiner Elements has limited support for my mouse and doesn't recognize the events its extra buttons trigger. So I'm forced to use the Right Click (Button 2) which it does recognize. But that comes at the cost of not being able to use the app-specific, custom mappings that the ever-so buggy-Logi-Options+ does provide.

The moment I allow Karabiner to modify events, the extra buttons on the MX Master stop functioning in the way they would without Karabiner.

So I'm forced to use another app (not Karabiner) that wouldn't conflict with Logi Options+ and I was hoping KM would do that job.

Now while I can get the Applications Palette to toggle on right click, I'm still not sure how to get KM to listen for a single keypress event with my left hand that would switch to a desired application.

I hope I've made my problem statement clear! :slight_smile:

Thanks for your time, guys!

Use a Conflict Palette – or single key triggers.

A conflict palette opens when a macro that shares the same trigger with other active macros is activated.

An example of a conflict palette:


Note the highlighted single letters. Those are single-key activators. (When more than one of the same letter exists pressing it will drill down to that letter set and provide different and more unique keys.)

With single-key triggers you can set your individual macros to use the single-letter hotkey as desired and to close the palette when pressed.


You also have the option of popping up a palette right underneath your mouse cursor and using the mouse to select your desired item.


Brilliant! This works great - Thank you! :slight_smile:

1 Like

As @ccstone mentions, the added advantage is you can use your mouse to select an item -- no need to put your coffee down and use the keyboard!

Using a macro per app also means you can add extras, so a switch in Affinity could hide everything else while a switch to Figma could also bring Chrome to the front and rearrange windows to suit -- the world's your oyster.

Just to chuck another option out there -- take a look at KM's Application Switcher macro. You should be able to set an "USB Device Key" trigger for it, so it activates on the mouse button of your choice. If you set the options to "Display horizontal icons" and "Place switcher under mouse" you could pop the Switcher with your mouse button then use the scroll wheel to select the app you want -- unfortunately you need to hit Return or Enter to activate the highlighted app, you can't click the mouse after scrolling to an app that's not under the pointer.

You can configure it to always exclude certain apps when they are running and always include certain apps even when they aren't -- effectively a customisable launch bar/switcher. And while you can only add apps, you can add AppleScripts saved as applications -- so it's trivial to add an AS app that runs a macro or opens a document for you!


I suppose I can ditch the buggy and inflexible Logi Options+ altogether and setup per-app macros for the MX Master too then, no? Karabiner Elements does register all buttons on the mouse by itself. It just doesn't work with Logi Options.

Thanks for your time! :slight_smile:

A follow-up question:

How do I hide the conflict palette within a specified time if no action was triggered?

I don't know if this is possible. What works is this: press a key that is not a trigger. For example Space. That almost always works. Or close the palette with the mouse.