My goal is to move the frontmost window by holding down key modifiers while dragging the mouse but without clicking. Is there a way to but KM into a "live" mode where it will continuously update
I'd also like it to move the window with the anchor point being the mouse's position within the window, not the upper-left tip.
I'm able to move a window incrementally by using a hot key and assigning
%CurrentMouse% to a variable and then setting that variable to the front window position. But I can't figure out how to continuously drag a window around just by holding modifier keys down and dragging the mouse.
What is the purpose of this workflow? Why not just click the mouse button on the window and drag it to where you want it? That seems simpler to me than holding down a key while dragging.
See Manipulate a Window action. You can use the current mouse position as data to move it.
If I want to move a window, I find it's faster to hold modifiers down and simply dragging from anywhere within the confines of a window, versus navigating the mouse to the top of a window then clicking and dragging.
Is there a way using KM to just click anywhere within a window and drag using that click point as the anchor?
The attached action will set the anchor point of the mouse's position inside the window, but I don't know how to live update the position while dragging, if that's even possible.
Yes, very easy, and you don't even have to click.
Just move your mouse where you want the window, and trigger the macro.
Here's an example to move the window center to the current mouse position.
You can adapt as needed. You will want to modify to ensure the all of the window is within the screen. But this should get you started.
Below is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.
Please let us know if it meets your needs.
MACRO: Move FrontMost Window to Mouse Location [Example]
-~~~ VER: 1.0 2020-05-07 ~~~
Requires: KM 8.2.4+ macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))
DOWNLOAD Macro File:
Move FrontMost Window to Mouse Location [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.
Piggybacking off @JMichaelTX's idea, the only thing missing for your needs is an enclosing loop. Here's another take that just uses KM functions instead of tokens and variables:
Move Front Window with Mouse.kmmacros (2.3 KB)
Once you trigger this macro, the front window should start following the mouse until you hit Escape. You could also do the same thing with JM's macro by enclosing it in an Until loop in a similar way.
Both of those solutions worked well. Thank you so much for your help.
Just for the sake of my curiosity, would there be a way to make the anchor point the mouse's original position inside the window instead of it being the window's dead center?