I'm trying to make a small sign shown on the screen to remind myself that a macro (or certain macros) is enabled.
I have tried "Show Global Macro Palette" and the Custom HTML Prompt. Each Has advantages and limitations.
The Global Macro Palette is not designed for my purpose, but it's small and fits my needs. The limitation is that because of its own purpose, I don't have much room for customization (see my comments on the Custom HTML Prompt below).
The Custom HTML Prompt is much more flexible. I can design it's background color as well as the text I want it to show. The latter allows me to show different signs for different enabled macros.
This is almost perfect. I said almost because there is one thing that bothers me: the KM engine icon in the menu bar is constantly flashing whenever there is a Custom HTML Prompt.
the Display Text window does not make the KM engine icon flash, but its smallest possible size is still too large for me in this case:
It's a bit complicated, but the logic is simple. I'll try to describe how I did it.
Create Two Macros
Create one macro in KM.
KM macro: If %TriggerValue% is "AppleScript", then disable the macro group. Else,
if the macro group disable, enable a macro group (or a set of macros) and then call BTT to bring up the floating HTML window (the small sign to show that the macro group is enabled). Eles,
disable the macro group.
Create one named trigger (equivalent to KM macro) in BTT.
BTT Named action: to bring up the floating HTML window. This is just a very small icon (screenshot below). At click, it (1) triggers the KM macro to deactivate the macro group via AppleScript (with parameter "AppleScript") using JavaScript in the floating HTML window and then (2) closes itself.
Workflow:
use hotkey to trigger the KM macro.
Result: the macro group is enabled, and the BTT named action is triggered, displaying a sign (can be anything we design).
BTW, BetterTouchTool allows the HTML background to be transparent. Therefore, you only see an icon above, no window title bar etc. Shout out to @avialan who has just made a feature request for Translucent Custom HTML Prompt for KM.
If I want to disable the macro, just click this sign. It will call Keyboard Maestro to trigger KM2. Then it closes itself. The cycle is complete.
Floating HTML in BTT
The key is the floating HTML prompt in BTT. Thankfully, BTT has already provided an excellent example here (See especially the example: "Transparent webview that displays a fancy action menu"): https://docs.folivora.ai/docs/10_0_floating_html_menu.html
Edit: Made some improvement. only one macro needed for KM and BTT respectively.
I use the BTT HUD display very often in my KM macros, as I really appreciate the centered display for actions.
Here is an example how I start the recording of my internet radio in the background and the BTT HUD Display confirms me the execution of the KM macro.
Thanks to the (free) app AnyBar, the recording in progress is shown to me in the Menu Bar.
The developer was kind enough to provide an AppleScript for the HUD display, so that I can easily integrate it into any KM macro.
Thanks, @appleianer.
This looks very nice. It meets my needs. I wish I knew it before. I may use this instead. But I'm glad I had another successful attempt in integrating KM and BTT.
Does this script still work for you? I can only run it, from Script debugger, when the full BTT app is running. Otherwise, I get nothing. It used to work but no more.
Thanks for your test and response @appleianer. This no longer works for me. Other AppleScripts work fine. And this one works, from the Script Editor, as long as the BTT app is open and in focus. If looked in the Sys prefs Accessibility/Privacy sections and played the remove/add game. No dice. I contacted the developer weeks ago. Iโve thrown in the towel.
Hey @appleianer,
So far itโs just the HUD script. I only have the one AppleScript BTT script. My setting is the same as yours. It has to be something else. Because of the nature of how it runs.
At the time I asked the question, my knowledge of the Custom HTML Prompt was much more limited. Now, with KM10, we can hide the title bar and use translucent background. KM should be sufficient for most use cases.
Hello @appleianer,
I managed to figure out the issue. I had the BTT app only open on a certain desktop. So any HUD overlay would open on the same desktop - regardless if the BTT app was open or not. When I moved the declaration to All Desktops, the HUD shows fine everywhere.
I have Keyboard Maestro and other applications, on certain desktops, but the notifications, alerts, displays and prompts work everywhere. I'll chalk this up to a lesson on difference of opinion. The HUD Overlay should work on any desktop, IMO.