Sticky Palettes! They move when you do!

Sticky Palettes! They move when you do!

I like to have my palettes "docked" next to their windows, and if I move the window, I want the palettes to follow it. If this sounds good to you, follow the following simple steps.

First, download and install my "Snap Palette to Front Window Plugin Action".


Now, let's say we have a Macro Group called "Mail Palette", setup something like this:

We need a Macro Group that is available only when Mail is active, something like this:

And lastly (but see NOTE below), let's add this macro in the "Mail Active" Macro Group:

For "Macro G...up UUID" (aka "Macro Group UUID"): in the KM Editor select the Macro Group "Mail Palette" and then do "Edit->Copy as->Copy as UUID", and paste it here.


That's all we need with one caveat:


NOTE:

At the time of this writing, there's a minor glitch in Keyboard Maestro where the "focussed window" triggers we used in "Mail Palette" won't fire when the application (Mail in this case) is initially launched. You have to switch away from the application (i.e. Mail) then switch back to it one time before the palette becomes "sticky". Theres a workaround for this, below.


What if we want the Palette to stick to the application's "Main" window only?

If your application opens up other windows besides the main window, you may decide you don't want the palettes to snap to the other windows.

If you can find something unique about either the Main window, or the other windows, you can surround the "Snap Palette" with an "If" action, similar to this:

For Mail:

For HandBrake:

Devise your own as needed.


Workaround for the "Application First Launched" issue

As I mentioned previously, due to a small glitch in KM (at the time of this writing), the "focussed window" trigger conditions don't work when you first launch an application. Here's a quick workaround:

This workaround is for VLC. It will work with anything, though.

In a macro group with no conditions, I added this macro:

Then I changed the "Snap Palette" macro to add an additional "if" to the beginning:


That's it!

Let me know if you have any questions or issues.

8 Likes

Wow. This is terrific - amazingly helpful. Thanks very much

1 Like

Thanks for this wonderful macro! I've used it for a few months and find it most useful. I have one minor issue, sometimes when I switch quickly between two applications the macro does not seem to have time to finish. That's no problem in itself, but Keyboard Maestro issues an “Action Failed” notification when this occurs, which becomes annoying as it may happen many times during a work session of one hour or so. I've tried to adjust settings so that no error notification should be posted, but without success, and I wonder if this behavior is intrinsic to your “Snap Palette” action and if it's somehow possible to ignore errors and get rid of the notifications?

If the error message is coming from my action, then you have version 1.0 installed, not the most recent, which is version 1.1. One of the things version 1.1 added was "eating" any error messages, to avoid just what you're experiencing.

Install version 1.1 from the link below, but make sure you read the "Installation Instructions" first, especially the second bullet point about updating a previous version.

Let me know if you still have problems.

Thanks for your feedback! I've installed the new version now, and from my initial tests it seems to have solved the problem. I'll let you know if there are further issues.

Hey @DanThomas
Currently there is a have palette appear at the cursor's location option. Given you've got the palette's appearance relating to a window's position, could you have them related instead to the cursor's location? If we could set a palette's appearance location at a fixed x,y offset from the cursor's location, all sorts of options become available :star_struck:.

Assuming you already know about the option to have a palette appear directly underneath the cursor, I'm curious; what sort of benefits would a palette offset from the cursor offer that one appearing directly underneath doesn't?

Fixed palette locations allow gesture memory formation that shifting icons within current palettes break, for one. And what are keyboard shortcuts other than gesture memory :wink:? As my typing skills are weak and memory limited, I find keeping things on the screen to be easier. Also, distributing palettes circularly uses the space around the cursor more effectively.

Here's some ideas "around" :wink: this:

1 Like

IMO, often the cursor is over a part of the window that you need to see/use in order to properly select a macro on the palette. Having the palette offset would allow you to see this critical info.

1 Like

Hey @DanThomas another thought on this. Can a palette be set anywhere relative to a window, e.g., if the window is a text or graphic document could a palette (be it icon or text) be fixed to a location on that document to function as a button/trigger in a HyperCardish sort of way?

Absolutely.

I'm not sure if those point to the current versions, so you'll have to do a little research.

Also see the token %FrontWindowPosition%

It's also possible that, by now, there's other ways to get a palette's position and move it, but these are what I've been using.

So I position a palette where I want it, then trigger a macro that gets the palette's position, gets the front window's position, and stores the offset in a variable.

Then when I want to reposition the palette, I get the front window's position and move the palette to the appropriate offset.

I hope that makes sense.

:flushed: it does kinda make sense. I’ll play with this. You are a good man DT, thanks!

Could the offset for palette positioning be relative to the current cursor’s position rather than the window’s position?

Yes, of course. It can be wherever you want it. It could even have nothing to do with any of that. I was just showing one example. :smile: