Is there a Toggle behavior for under the Keyboard Maestro menu icon?

I have a macro that appears under the Keyboard Maestro menu icon (by using Status Menu Trigger). But is there a way I could have its text change from: “Enable the XYZ” to “Disable the XYZ” based on a variable state? I just wanna be able to toggle on/off some behavior… (which I am doing successfully)… but also have the state visible in the Keyboard Maestro menu dropdown in the macro’s name?

Right now I’ve just got the macro’s title showing up as “Toggle the XYZ”… and I kinda have to just know if the state is already toggled on or toggled off.

You cannot change the displayed name in the Status Menu.

But you could have two macros, one with each name, each of which enables the other and disables itself.

1 Like

Could you think of any way to show the status of a particular macro? Like to have a little green light somewhere on screen that would “turned on” when your process is enabled and off when it’s disabled? Maybe it’s beyond the scope of Keyboard Maestro… but since this community is focused on nice solutions to automation… I wonder if there would be some nice way to visually SHOW…. that a particular global variable is in the state of 1 or 0. :thinking:

As a start I do not know how to do what you re asking but others here are far more knowledgeable than me and may be able to assist.

Although it is not exactly what you re asking for, it is fairly easy and possible to get notification when the state of a global variable changes, would this suffice?

What I do is use a macro group. Then you have an option to display it in the menu bar and it can take the display value from a variable.

1 Like

You can at the very least get close with a Custom HTML Prompt.

I suck at HTML, but LLMs are okay at it, so here's a working proof of concept that resembles what you ask for.

The script runs asynchronously (so that the rest of the macro can continue while the script runs in the background). If a named variable starts with a "1", it will display a dot with set color, position, and diameter, and it will display this dot until this variable does not start with a "1" (so basically while the variable starts with a "1").

The HTML reads in five commaseparated parameters from the variable "local_parametersForDisplayDot":
Parameter 1: Name of variable to watch for starting with a "1" or not. This variable can be global, local, or instance.
Parameter 2: Dot Color Hex value. Can be of form #00FF00 or 00FF00
Parameter 3: Dot center X-position
Parameter 4: Dot center Y-position
Parameter 5: Dot diameter

For example: myVar,#00FF00,800,400,12, for displaying a 12 pixel diameter, green dot, centered at screen position 800,400, if the value of global variable "myVar" starts with a "1"

One can also use Functions in the parameters by setting it up something like: local_myVar,00FF00,%Calculate%WINDOW(Right) - 12,WINDOW(Top) + 12,18%, for displaying an 18 pixel diameter, green dot, centered 12 pixels to the left of and below the right corner of the focused window, if the value of local variable "local_myVar" starts with a "1"


Display Colored Dot While Named Variable Hold a Value of "1".kmmacros (KM v11.0.4, 20 KB)

Macro image

1 Like

You can use the Mark Macro action to make the macro which will show up as a Tick in the status menu.

You could enable or disable various macros that show up in a palette - for example if one was a Red Dot and one was a Green Dot, you could toggle the enable of them.

You could use a Custom HTML Prompt action to display a web window. This can be transparent and floating allowing you to do anything you want with it.

2 Likes

This might be what you want:

1 Like