Control where Palette is displayed when using "Show/Hide Macro Group" action

When using the "Show/Hide Macro Group" action > "Show/Hide palette", the palette is displayed wherever it was last positioned.

Is it possible to control where the palette is displayed? I'd like for it to always be displayed in the Front Window of the Front Application but can't get it to work. Any help is much appreciated, thanks!

(similar question here from 2019)

Here you can find a plug-in action to move a palette. I was very happy when I found it a few weeks ago.

You'll have to figure out where you want to move it via the front window position, of course.

1 Like

Thanks so much @devoy!

Scrolling down that thread I came across an Applescript I modified to suit my needs.

Just in case anyone stumbles across this in the future, I'm attaching the final macro here.

Reposition Palette to Front Window.kmmacros (9.0 KB)

Macro screenshot

I use it as subroutine after the "Show/Hide Macro Group" action. This macro determines the active screen (useful if you have 2 monitors), then positions it to the active screen. You'll need to customize this line in the "Move to Second Monitor" action to match wherever your second monitor is

2 Likes

Bumped into this when searching Google / Perplexity for an answer.

Problem + solution below, to show a palette at the mouse location.

--

I've been using KBM for about 7yrs, life changing of course, mostly tied things to keyboard shortcuts that I just memorize. Starting to consider palettes more.

Also, this is my first post on the forum. :slight_smile:

I have a macro group with "shows a palette for one action when {keyboard shortcut}", and ✓ "Place palette under mouse" (helpful). But I want the ability to "nest" palettes, so one of these actions simply calls "Show Macro Group {name} for One Action" to another group.

Problem: that 2nd palette would show up somewhere random. Annoying, if not problematic, on 2 large monitors.

I looked at @devoy's plugin recommendation but had never used a plugin in KBM before and saw a date stamp of 2015, then I saw this solution from @adamg which didn't actually work and I admittedly only kinda understood, even after passing it to ChatGPT to help me tweak the code.

I (we?) ended up writing new AppleScript to accomplish what I needed, I think more simply, but based off of his original ideas. It's attached, incl. screenshots.

--

How I'm using it:

  • Wherever a "Show Macro Group" action is included within a macro, follow it with a call to this subroutine.

How it works:

  • Gets the current mouse location into 3 variables, just 'cuz. mouse_xy, mouse_x, mouse_y
  • Passes into AppleScript as xPos and yPos, must convert to integer, then adjusts a little so the palette X button is actually under the cursor
  • Does some stuff to position the palette
  • There are a couple of debug statements commented out, which I used to test whether the AppleScript was really getting the right coordinates, etc.

--

Hope this helps someone out there! This forum has helped me countless times.

:arrow_down: Goodies below.

palette - reposition to mouse position.kmmacros (4.2 KB)

Screenshots


applescript screenshot

1 Like