I need to show a specific Macro Palette when right-clicking any window's title bar (perhaps using an additional co-trigger of holding down a particular modifier key to override invoking the default context menu like when right-clicking e.g., the KM Editor title bar). But there seems to be no mouse-click/window-click trigger in KM. How can I achieve this?
This sounds similar to the question linked to below. There wasn't an obvious solution as there is no condition that allows a trigger based on mouse location.
It is fairly simple to have the Palette triggered with a right-click of the mouse in a specific App when that App has a specific Window Title. But that would be a right-click anywhere on screen, not just in the Window Title Area. You could achieve that like this:
EDIT - Actually there might be a way to make a condition based on mouse location by saving the current mouse location to a Variable and then comparing that to an ideal location (near the top of the window). If the current location is within a range of the ideal location (the window title bar) maybe that can be used as an additional condition in the example above. But it seems like a lot of work to invoke a Palette...
Why not just give all your Application Group Palettes the same hot-key? Pressing this hot-key will open the specific Keyboard Maestro Palette for whichever App you are in. That's what I do. In my case I use ⌥⌘K as the same hot-key for all my Groups.
That's a good idea. However, that would require creating a MacroGroup Palette for each application, which is not feasible.
What I need is to show a specific MacroGroup that does actions for the current whatever application or window respectively. To achieve this, I have created the following macro:
However, there is no option to place the Palette under the mouse.
Why is that? If the Macros are specific to certain Applications the easiest solution is to make Macro Groups and include in those Macro Groups the Macros you want for each App.
Maybe give an example of what one of your Macros does as I am probably misunderstanding what you are trying to achieve?
The Macros are not specific to a certain application. One of the macros in this MacroGroup would be to copy the text of the current window's title bar to the clipboard.
However, I have changed my macro to:
This works well by showing the "General Macros" Palette at the mouse position. However, after duplicating this macro and assigning another hotkey and another MacroGroup to it, that macro always shows the palette at a fixed position on the screen. Why?
So, set your Group "General Macros" up like this:
No need for a second Macro to invoke the Group Palette, it is set up from the Group itself.
Thanks, you are right: There is no need to create an extra macro to show the palette.
However, there are two drawbacks:
- The ESC key does not hide the Palette
- The Palette often hides the write cursor and what I write in a text editor. So it would be helpful if the Palette would not center at the mouse position, but should be displayed at its upper left corner at the mouse position.
Is there any remedy for these drawbacks?
Yes, and you can also close the Palette by tapping the same hot-key (so, in your case, ⌃⇧W)
This is why I tend not to use "Place Palette under mouse". With that option unchecked, the Palette will pop up in the position I last dragged it to, which I find more useful.
Thanks for your advices.
I use a huge monitor. So your option often places the Palette in a position that is far away. So if there were more flexible Palette placement options it would be helpful.
It is hard to give an answer to this. Keyboard Maestro can place the Palette under your mouse pointer - but you say that gets in the way... and Keyboard Maestro can place the Palette where it was last positioned - but you say that might be too far away on a large monitor. I also work on a very large monitor and have never come across this problem - maybe because for years I have set my mouse to the fastest possible speed which means a tiny movement of the hand moves the mouse pointer to any point on the screen.
You can put the Palette in a precise spot using a third party plug in, which allows you to put the Palette in an exact position every time. I suppose you could make a condition that alters this position depending on what App you are using.
I am wondering if the below could be of help to you:
Hi @Peter_Panino I had another think about this and suddenly realised there is a simple solution to having the Group Palette appear offset from the current mouse position rather than directly under the current mouse position.
Basically you set up your General Macros Group so that the Palette appears under the Mouse as you have already done:
Then you call the Group Palette with another Macro that does three things:
- Repositions your current mouse by an offset to the right.
- Invokes the Palette (which will appear under this new offset mouse position).
- Moves the mouse pointer back to where it was.
The result is that the Palette appears not under the mouse but offset to the right.
Here is a little Gif showing it in operation. And below that is the actual example Macro. You can change the offsets (for both sideways and vertical) for whatever you like. Just remember to put the same offsets in the last Action and the inverse of what you set (so 100 becomes -100).
(Oh, and the same hot key will both open and close the Palette.)
EXAMPLE - Put a Palette near to Mouse Position but not under it.kmmacros (3.6 KB)