How to Have Multiple Conflict Palette Styles

This is a feature request, unless someone can think of how to do it with the existing Keyboard Maestro tools.

Keyboard Maestro defines four different palette styles, for four major different types of palettes.
image

I use Conflict Palettes in different situations, for different sets of macros, both downloaded from Macro Library here and created myself. Unfortunately, it's been difficult to nudge the style into a One-Size-Fits-All set of parameters. Most particularly, one palette just works better as a two-column list because it has a long list of short entries, but when I set that style, another palette gets ugly because it has two long names which would look a whole lot better stacked instead of side-by-side. (I'd also like to have them be different colors, but that's just a tweak, not core functionality.)

image

image

Is there any way to have different Conflict Palettes have different styles, particularly different numbers of columns?

I haven't been able to think of a way that Keyboard Maestro could even tell the difference to be able to display one palette in one situation and another palette in another situation. KBM has to be ready to accept any hotkey instantly, and when there is a conflict, more than one macro to be triggered, it displays the list of conflicts. Something would have to be inserted into the process so that a particular hotkey, known to generate a conflict, can be set to use a specific palette style, dedicated to that hotkey, where other hotkeys get the default style.

Thinking about the definition process, there would have to be an option in the Palette Preferences menu that would allow you to "Add a Dedicated Conflict Palette Style". When you add a Dedicated Conflict Palette style, It asks you to provide an "Optional Title" and a Required Hotkey. The supplied hotkey is then attached to that specific Conflict Palette Style so that any time that hotkey is the key generating a Conflict Palette, the specified style is used instead of the Default Conflict Palette Style. If the Optional Name is given, that becomes the title of the Conflict Menu, when it is displayed.

After Dedicated Conflict Palettes have been defined, the Palette Preferences menu could either display all dedicated Conflict Palettes, or there could be a "More..." button under the Conflict Palette Default Style that would take you to a separate menu of dedicated Conflict Palette Styles.

There would also have to be a way to ensure that the same hotkey is not assigned to two palettes.

1 Like

You can script the custom palette colour via KM preference scripts (near the bottom of the page).

I'm not sure if any other aspects (column numbers etc) can be scripted, but if they can, you could potentially set the palette style programatically.

@peternlewis will know for sure.

No, there is only one style for conflict palettes.

Thanks @peternlewis, that's what I figured.

Did you read my feature request description of how it might work.

How contextual is your choice? Is it something like "Application A has long-named macros, use one column; application B has short-named macros and could use two"?

You might be able to do something like a macro that triggered on context change and used an "Execute Shell Script" action and defaults write... to set the ConflictMacroPaletteStyle plist entry appropriately.

Totally untested and could go anything from "Perfect!" through "Did nothing" to "Nuked the Engine prefs" -- so back up the plist first and handle with care!

I, too, found the palettes quite helpful right from the start but eventually wished I could manipulate the display a good deal more. Having one custom palette gave me one option but I could use a dozen.

I also wanted to align columns and display a hierarchy of commands and, well, a lot more.

So I gravitated to mimicking palettes with the Custom HTML Promp action.

I used a transparent layer so I could use rounded corners on the (transparent) palette and I wrote some JavaScript to handle keystroke processing with CSS showing the hot keys. And I made the text larger than the normal palettes I use.

All the individual macros that used to populate the palette became part of this one larger macro because i found that saved space in the plist but I suppose you could simply call the existing macro.

Here's just one example:

ss-516

2 Likes

Yes, but I'm unlikely to implement that much UI to add that feature which is unlikely to get widespread use.

I understand. Looks like I'll be exploring Custom HTML Prompt to do what I want.

Would you be willing to share that so that I can see how it works?

1 Like

Sure.

The Prompt is where the magic is. It sends a single letter choice to the following Switch for what used to be individual macros (several of which are specific to my content management system).

Markup Pal Macro (v10.2)

Markup Pal.kmmacros (60 KB)

Keyboard Maestro Export

1 Like

Thanks Mike,

I loaded your macros and banged on them a little. It was clear that the first part of the macro described a menu that was not the one that you showed here previously. Based on your macro rules, I opened BBEdit and created a file called .html in a temp folder. That context let me open your CSS and HTML menu.

Then I realized that the Regular Expression you used to match filename patterns was not anchored at the beginning of the string, it would match any file with .html in the name (actually, as you spelled it out, any window where .html was in the window title). I changed the name to be not one of those files and I got a different menu, the Markdown menu that you showed above. Cool!

There's definitely some useful examples here. I still haven't worked through how the menu choices work, but I'll get there.

1 Like

Hi @peternlewis. I can certainly understand that it would complicated to provide multiple styles for true Conflict Palettes—i.e., palettes that are rendered when macros include the same hot key trigger.

I'm a huge fan of Conflict Palette selection behavior and, like @August, I have often wanted to vary the number of columns. I have a suggestion that I suspect would be easier to implement and would be similarly beneficial...

Several months ago I discovered (yes, it's clearly documented) that palettes rendered using the powerful Show Palette of Macros action appear and operate like the aforementioned Conflict Palettes.

Keyboard Maestro Export

@peternlewis, please consider adding an option to specify the number of columns. Thank you.


Related...

@peternlewis, I've noticed that the link for the contextual help is broken when Include in Touch Bar is checked.

Keyboard Maestro Export

1 Like

The original screen shot and the subsequent codes are indeed from exactly the same macro. I don't know why you suspect otherwise.

The menu choices involve Javascript (with visual CSS help) in an HTML form.

The macro isn't designed as an example, of course. It's working code (for me). For anyone who gives it a try, it will appear more as a puzzle, I suppose. But if there's enough interest, I could build something simpler to illustrate the concepts. One of these days.

1 Like

Sorry for the confusion. All I meant was that your screenshot above was from the second part of the macro and the first part was clearly describing a different menu. That's how I discovered that the macro provided two different menus, depending on context, which I had not realized.

Ah, thanks for the clarification. I can see how that might be confusing.

Yes, that macro (for anyone reading along) presents a different menu depending on what kind of file you're working on. One for HTML/PHP/CSS files and another for what resembles Markup files.

That so if I want to italicize something in an HTML file it gets the HTML tag for it while the Markup file gets the Markup delimiters. I don't have to think about the code.

1 Like

Noted.

Fixed. Thanks.

1 Like

Here's an alternative palette strategy that I use.

Nearly all my macro groups are set to display as palettes and use the same hotkey. I use the ~ character.

With the macro groups scoped to particular apps, I get different conflict palettes depending on which app is active when I type ~.

Next, I use palettes that are always on screen and in the same place in most apps that are tailored to fit within an app's window sidebar or toolbar. I rely on icons from Sf Symbols for very short palette names to keep these palettes compact. Within those palettes, I use the 'Show Macro Group for One Action' action so I am one click from an ad hoc collection of macros. As a bonus, doing this for a toolbar-positioned macro group has the effect of adding a drop-down menu to the window's toolbar when the 'Show Macro Group for One Action' group is set to place the group under the mouse.

Lastly, I have a catch-all palette that I call up with a gesture that includes any macros that don't fit in the above.

I understand that this strategy depends on working a particular way that may or may not work for you. As I'm not likely to use the Custom HTML Prompt, it's a workable alternative.

3 Likes

I would love this feature too.

Done for the next version.

3 Likes

Thanks! I'll mark this question as answered when I get to try it.

1 Like