Holding Modifiers through a Simulated mouse click

Hi,

I'm trying to wrangle Quicklook to re-create a feature it used to have, which is "zoom to fill", the equivalent of the CSS backgound-size: contain.

Unfortunately since around Mojave, small images always show at native pixel size in quicklook, regardless of the size of the quicklook overlay window.

There is a workaround for this, which is to hold down control when clicking the next image (this is a multiple display workflow). That will open the image scaled up, but it also triggers the contextual menu.

Holding down control and option before clicking prevents the contextual menu from being triggered, but any drag at all causes the image to be duplicated.

So, I need to figure out a macro I can assign to be fired by my 6th mouse button (which will fire off an F19 thanks to Steermouse) which will:

  • hold down control & option.
  • click and release (without drag) the primary mouse button at wherever the cursor is.
  • THEN release control & option.

If I do this by hand, it works fine - I hold down control & option, click the image, and it opens in the quicklook window zoomed to fill.

BUT I can't figure out a way to get KM to do it.

I tried recording the action, and it recorded it as Move and Click with the modifiers set, but when the action is actually run in Finder, it doesn't work.

I get the feeling it's some sort of timing thing, that KM is releasing the modifier keys early (ie at the same time the click triggers).

If there's a way to hold those modifiers until after the mouse click has completed, I'd appreciate hearing about it.

Thanks.

I don't have Outlook, so I can't test there, but this seems like a thing that should "just work." This is my entire test macro for Excel, which is an app I found that treats Control and Control-Option clicks differently:

Start simple: Take your mouse and SteerMouse out of the situation. Create a simple "Control-Option click at the mouse location" macro, assign it to a hot key trigger, and test it in Outlook. Does it work?

-rob.

Quicklook, not Outlook. As in, Finder. :wink:

But yes, with the mouse and Steermouse out of the loop it doesn't work either.

Regardless of what actual keystroke I use to invoke it, if I manually hold down the control key first, then click with my mouse, quicklook opens the image scaled up to fill the quicklook window. But configuring it in KM it doesn't work.

Interestingly, if I set the combo as a macro within Steermouse, it works correctly, BUT steermouse doesn't have the option to disable drag.

Oh, sorry, totally misread that! :slight_smile: But that confuses me: How are you invoking QuickLook? Control-click on an image doesn't open QuickLook; selecting the image and pressing the Space Bar does.

So how are you making a Control-Option-click open QuickLook?

-rob.

1 Like

OK, once you've invoked quicklook with space, you can put the quicklook window onto a secondary display, where it will stay open, and then any image you select with the mouse subsequently will display in the quicklook window.

If you hold down Control when you click the image, it will scale it (up) to fill the quicklook window if it is physically smaller in pixels than the window.

But, that will also cause a a contextual menu to trigger on the finder thumbnail.

So instead, holding option & control will cancel out the contextual menu, while still allowing the zoom function to work.

Thank you for the more-thorough explanation of the process—that wasn't clear to me from the initial posting at all (I don't use QuickLook much other than in Space Bar mode), which led to some of my confusion. Sorry about that.

I agree it doesn't work in Finder as described. After some futzing, I got something to work, though I didn't test with it assigned to a mouse button. But this seems to work in Finder; I assigned it to Shift-Command-F (just so Control and Option weren't involved, to prevent any possible modifier key confusion).

app-Finder Macros.kmmacros (6.2 KB)

I had to use two macros. The main macro is the one with the hot key assigned:

This launches an asynchronous sub-macro, then just clicks the mouse (no modifiers) and sets a global to true.

The async sub-macro:

This one just repeatedly presses and holds (via the Gear menu's settings) Control and Option, until the global set by the first macro is true. It then deletes the global.

I tried without the repeat loop, but even when set to press and hold, if they're not repeated, it just doesn't work.

Maybe not ideal, but it does seem to work.

-rob.

Sorry for the delay - I tried it, and while it's suppressing the contextual menu, it isn't zooming the images consistently, which makes me suspect that the control key isn't being passed through / is being cancelled during the process, or its encountering some sort of rate limiting.

This Steermouse macro works (though there's no drag restriction*), while the KM macros don't, even from pressing the keyboard key with the mouse hovering over the image I want to invoke in the Quicklook window.

*Am I going about this the wrong way - is there a way to ONLY disable drag for the duration of a mouse button press in KM, while leaving the Steermouse macro to do the actual key combo?

At this point, @peternlewis is probably the only one who might be able to explain what's going on, and why it might work differently in the two apps.

-rob.

Unfortunately it appears the Finder/Quicklook is looking at the physical modifiers and not the event modifiers. That's what I'd expect from third party cross platform apps, and it's pretty disappointing for Apple software.

so the reason its working with Steermouse is... because it's specifically a hardware interfacing application?