How to make Palette automatically follow cursor

Hi - Does anyone know if it's possible to have a palette automatically follow the cursor? Thanks for any and all help!

Did you read this post:

Do you mean "an already open palette moves as I move my pointer" or "a palette always opens under my pointer, wherever it might be"?

Thanks Nige, I mean "an already open palette moves as I move my pointer"

I don't believe that's possible with a standard palette. In theory, you could use an HTML input prompt and some Javascript to make a custom floating palette that moves with the mouse. But as that level of Javascript is above my pay grade, I asked ChatGPT…and it came up with functional code on the first try:

Big caveat: I have no idea how/if you could implement this in Keyboard Maestro's Javascript action. But I think this is the only method that would potentially do what you want to do.

-rob.

You could, I guess. But you'd have to run something that grabbed the pointer position and fed that to an AppleScript. This script, for example, will move the "Menu Glyphs" palette from wherever it is to the top left of my main screen:

tell application "Keyboard Maestro Engine"
	set thePalette to item 1 of (every window whose name is "Menu Glyphs")
	set currBounds to bounds of thePalette
	set theWidth to ((item 3 of currBounds) - (item 1 of currBounds))
	set theHeight to ((item 4 of currBounds) - (item 2 of currBounds))
	set bounds of thePalette to {0, 0, theWidth, theHeight}
end tell

But doing that every 10th of a second could be problematic!

And I have to ask... Why do this? A palette that's always there but can't be clicked because every time you move the pointer it moves too seems... annoying, at best :wink:

@adamg, what are you trying to achieve, and why?

Thanks @Nige_S @Airy @griffman for the feedback & resources!

Trying to Achieve
I'm using an Applescripts & Apple Shortcuts to manage apps running in the background. I have them all in a Macro palette and would love if the palette was always near my cursor. Yea I know I can use a keyboard shortcut but I prefer clicking a palette :man_shrugging:

How to click Palette
I imagined the palette would move wherever the cursor is, and when I need to click the palette, perhaps holding down a modifier key would keep the palette stationary so it can be clicked.


But you bring up a good point, running a script every 10th of a second would be overkill. I was was hoping there was a similar solution to
Keyboard Maestro 04-16-2024 at 03.21.56 PM

But it doesn't seem like it so I'll just keep my current workflow - thanks all!