Snap Palette to Front Window Plugin Action

First of all, don't put the macro that snaps the palette into the palette group. Put it in a separate group that is only available when Finder is active.

So in my case, I have a group called "Finder Palette", and that's obviously the one that is the palette. But I also have a group called "Finder":

image

Inside the "Finder" group, here's the macro I use to snap the palette:

image

Note the trigger conditions. I have a Hot Key trigger because the palette doesn't always snap automatically. It does most of the time, but when it doesn't, I can fix it with the hot key. You can see the other triggers.

The conditions in the "If" action are an attempt at stopping the palette from snapping to the wrong Finder window. They work for me, most of the time.

Hope that helps.

Hi Dan, many thanks for your time and helpful posting.

I think my replication of your configuration shown in the screen captures is accurate. However, the symptom persists.

I quit and relaunched KM's engine, and the symptom persisted.

I think the problem is that I've configured to to-be-snapped palette's group as "Shows a palette until."

What should it be instead?

Honestly, I don't really know. Try changing things to see if that makes a difference.

Hi Dan, many thanks again for taking time to reply.

I think the problem is with Finder windows containing multiple tabs.

I have three Finder windows open on the Desktop, each of which has multiple tabs.

For these windows, the palette snaps when I press the chosen keyboard shortcut, but not when I make a different one of the three windows the active one.

If I open a new Finder window (with only one tab), however, then the palette snaps to it.

Then, when I move that window, the palette remains in its original location rather than following the window to its new location.

Do you have any pointers on how to resolve this scenario?

Finder is really a pain to snap palettes to, especially since the Desktop is technically a Finder window also. I've actually never tried it with multiple finder windows - I've only used one window, with multiple tabs of course.

So I don't really have any ideas for you, other than to see if the "snapping" macro is even being called when you move the windows.

Sorry, and good luck!

Hi Dan, many thanks for your posting.

New findingā€¦I assigned a keystroke to the snap palette macro. If I press that keystroke, the palette moves to the currently active Finder window.

I then created a new button to which I assigned the keystroke macro, and assigned the above keystroke to that macro. Then I placed this new button on the palette we're discussing.

When I click the new button, the palette remains in its current position. When I press the keystroke, the palette snaps to the currently active Finder window.

Is the above finding what you would have expected?

I haven't tried that, but it sounds like whatever the button does, you need to do it asynchronously. In other words, have it execute another macro that does the snapping, and have it execute it asynchronously.

Hi Dan, many thanks for your helpful suggestion.

Success! That did the trickā€¦woo hoo!

1 Like

@DanThomas

Thanks for a great plugin! :smiley:

Please consider adding the ability to offset palettes.

I often use multiple palettes and it would be helpful if I can for example snap palette A to the top right and palette B too the top right plus 300 Pixels to the right and 400 pixels down.

Thanks in advance for your time and consideration.

jhn

I'll see what I can do. I'm pretty busy right now, but you never know. :grinning_face_with_smiling_eyes:

Thanks for your reply and consideration.

No rush, whenever you have time.

Looking forward to see what you come up with. :smiley:

1 Like

OK, I have something for you to try. I've completely rewritten it in JXA , not that it matters to you except that I'm not sure how well I tested it. So I'd like you to try it out.

Some things I learned about installing this updated version:

  1. Delete the folder "Snap Palette to Front Window" in ~/Library/Application Support/Keyboard Maestro/Keyboard Maestro Actions

  2. Drop the new ZIP file onto the KM icon in the dock.

  3. You can restart the engine if you want, but I didn't seem to need to. File>Quit Engine and File>Launch Engine

  4. Shut down the editor and relaunch it. Otherwise you don't see the changes to the action in the editor. Took me forever to figure this out.

Let me know how it works. Thanks.

Snap Palette to Front Windowv2.0.zip (15.2 KB)

Works great! :grinning:

Thanks for your help! :pray:t2:

1 Like

Hey Dan, does this version replace version 1.1 in post 1?

Probably. I haven't had enough feedback to know whether it's functioning properly or not, since I rewrote it all in JXA instead of AppleScript.

It's not that it was terribly complicated, but there's a lot of "if" combinations, so there's no guarantee I coded each one correctly. I mean, I tested it pretty well, but I know I didn't test every possible combination.

Let me know how it works for you, if you want to try it out. If not, that's cool too.

Will do. I donā€™t have a large use case for it but Iā€™m gonna check it out anyway. Thereā€™s another post on here from this morning where somebody is asking about resizing a window up to the global macro palette edge. It made me wonder if your macro here would work for him.

hereā€™s another post on here from this morning where somebody is asking about resizing a window up to the global macro palette edge. It made me wonder if your macro here would work for him.

It won't work as written, but the concept is similar.

Snap Palette to Front Window v2.0 works great on the following:

TESTED WITH
ā€¢ Monterey, v12.1; Mojave 10.14.16; High Sierra 10.13.6
ā€¢ Keyboard Maestro, v10.0.2
ā€¢ MacBookPro16,1, Macmini6,2, iMac11,1

Isn't it incredible that something as cool as this runs on a computer nearly 13 years old with an OS that was released in 2017? Many and Apple, @peternlewis, and @DanThomas should all take a long bow!

Not in my wildest dreams would something like this be possible on a Windows platform!

1 Like

I know that I should be able to use the wiki and other documentation to answer this related question, but I'm having trouble putting together all of the pieces...

In a macro, can I control the visibility of a single group palette without affecting other palettes. I've tested Conceal Macro Palettes but that affects other KM palettes as well.

What am I missing? Thanks in advance for any guidance.

Thanks for testing it.

The short answer to your question is that yes, you can control the visibility of each palette separately. Either check out the Wiki for more information, or search this forum for the many, many topics on the subject of how to use palettes.

1 Like