Modifier during mouse drag

How can I have modifier held down until a mouse drag completes. Strangely it appears the modifier is held down (when watching the on-screen keyboard), but doesn’t actually register along with the click.

I’ve tried all sorts of combinations of hold until mouse press/release, click with modifiers, etc. Some methods work, but not not all of the time (somehow timing gets corrupted or something along those lines).

Basically, want I want to do is touch an onscreen palette button and have the option modifier engage, perform a drag operation, then have the option key released upon completion. Or even a toggle-able palette button (though that doesn’t seem possible, nor is it preferred).

Thanks to anyone that can help,


Hi Marc,

What is it you’re ultimately trying to accomplish? If you can share more details/screenshots about the exact app you’re working in, the exact palette button you’re trying to click and drag with modifiers, and the specific task you’re trying to accomplish by doing so, we should be better able to offer suggestions.

Hi Gabe. Sorry, I tried to be clear but maybe I underestimated the simplicity. Basically all I’m trying to do is have an on-screen modifier (option for instance) key that stays held down until the mouse drag that follows is released. For use in any app. A sort of one handed mouse operation so that I can access modifier based mouse behaviours without a keyboard. But for example, in photoshop I want to be able to simulate an option drag by doing the following:

  • clicking on a palette button which engages the option key
  • it stays held down while performing the click-drag operation elsewhere on screen
  • the modifier is released when the click-drag operation is complete

In is simplest form, this type of modifier holding “should” be easy by using “press and hold modifier” and delays. However, if doing a simple thing like:

  • press and hold option
  • pause
  • release option
    Does not actually affect mouse behaviour like the hardware key would.

In fact, this sent me down another testing path to test. Using a program called KeyUp which allows for an on screen keyboard that holds down it’s modifier keys when clicking them. The same thing happens there. It’s almost as if the software “option key” is different from the hardware “option key” and only the latter works.

The next interesting behaviour, is that this IS NOT a problem with other keys. For instance:

  • press and hold space
  • pause
  • release space
    Works completely!

So there is something going on here with modifier behaviour as it pertains to mouse input.

This is a critical function for me or anyone using KeyboardMaestro on pen and touch input OS X devices. Hopefully we can figure this out.

Okay, after a little experimenting, it looks like the Press and Hold Down Modifier action while clicking does indeed not work, as you described, but this does:

Click and Hold Mouse with Option.kmactions (1.4 KB)

The real question from here is how best to trigger it in a mouse-only workflow. Ideally, this would work best with a non-Apple mouse with multiple buttons, so you could assign one of those buttons to trigger this macro using the USB Device Key trigger, but I imagine you might be able to use one of the new gesture triggers as well. Otherwise, I'm not currently seeing any good options for triggering this macro without using your other hand to at least press a key to trigger it, though that method would at least let you avoid having to hold down a key for the whole drag like you currently do with Option.

Hi Gabe. Yeah. Those are the action types I've been playing with. But it seems there is some persistent buggy behaviour. Pretty much the same as I wrote about above. Where modifiers from Keyboard Maestro are handled differently than Hardware. For instance, the following is a way to handle a single button push to do what I want (the first part is weird but is just there so that the first click after palette selection doesn't register as a brush stroke):

The problem is that the modifier isn't truly released at the end. It is only partially, and this is the weird part. It's no longer behaving as if it was, but the next keystroke or modifier doesn't work unless one of the hardware modifier keys is touched. So for instance, 1) performing the above, then 2) trying to spacebar-drag (even with the hardware keyboard) doesn't work. 3) hitting any of the hardware modifiers then finally releases this "hold" and you can do anything after that. Until the next "software invoked modifier".

This is really weird. Not sure if it's an OS thing, or Keyboard Maestro thing, but it makes any of these things I want to do with the app impossible. A fairly significant bug that we can hopefully figure a way around.

Lastly, you'll notice that the end of that macro is a little redundant. Perhaps this is part of the buggy behaviour. For some reason the "release mouse button" is considered a "held key" and present with a warning (which it probably shouldn't). So the extra key release is there just to make sure the macro ends nicely.

So in addition to the above. I did a little more testing. And it’s definitely related to the difference in input sources. I was hoping to get a temporary and clunky workaround using OS X’s Sticky Keys, but unfortunately that doesn’t work at all from Keyboard Maestro. Not that it’s important, but it shows the problem likely stems from the different sources. Either the way the OS perceives the input is causing this, or the way KeyboardMaestro is outputting the modifiers.

You basically cannot do this, because when Keyboard Maestro simulates a modifier press, any hardware event will not include that modifier. So as soon as you drag the mouse, the system will see a drag without the modifier.

Basically, you cannot mix simulated and hardware UI at the same time.