Is it possible to make a toggle button on stream deck that would show if a particular menu item was checked?
I know I can use Stream deck to control a menu item using KM link, but I would like the icon on the stream deck to display if that menu item is checked or not checked on the same button that I use to toggle the item.
I have a feeling this is not possible but thought I would ask.
Not really, because there is no appropriate trigger.
You could have a macro check the marked state of the menu and report it in a Stream Deck button, that is relatively straight forward.
But there is no way to know when it changes short of polling it periodically which is generally not a good idea though it might be something you could do in this case if it is limited to when the application is at the front, and ideally also limited in other ways.
Can you show me how to do this? Ideally would want to check the marked state of the menu item, and then send that to the Stream Deck Set Image of A Button, so I could make one image for checked and one image for not checked.
Here's a basic example:
Stream Deck - Menu Item Status.kmmacros (20 KB)
This will display "Light" on Stream Deck button
R1C1 if the menu item
View > Use Dark Background for Windows is marked in TextEdit.
Note that you must use the native Stream Deck Keyboard Maestro plugin (i.e. not KM Link) to set button icons programatically.
How you trigger this will depend on the menu item in question and your work habits. In the case of this example, it would probably be enough to check the menu item whenever the front window title changes in TextEdit.
Not sure if this helps. But if you use the Stream Deck to toggle the menu item you can use the "Multi Action Switch" and just use KM Link to assign the macros that check and un-check the menu item. On the Stream Deck you can use your own icons for that particular button that changes if you use it as switch which shows you the current status.
All though simple to set up, the problem with this approach is that it gives no real feed back of the actual state of the menu option. It is very prone to fall out of phase with reality where it will display the opposite of what is the true state. The other disadvantage of this approach is the (in my view) very ugly and distracting green check mark the Elgato software displays whenever a Multi Action Switch is performed.
I was almost certain I had reseached if this was possible or not, but anyways wonderful news to me here now!
They recently added the option to disable the green tick, but I agree with you on the lack of feedback.
Oh Man Thank you so much! I had no clue you could set it up like that in Keyboard maestro. I was trying using Apple Scripts and it was just so confusing. Thank you for taking the time to do this for me.
I have it set up using two buttons on the stream deck the Bottom button triggers the script to check and presses the hot keys, and the top button displays if its checked or not.
If only someone could combine the functionality of the Keyboard Maestro Plugin and the KM Link Plugin I could make one button that did both! But this is very close and It will work. Thank you every one so much.
Why do you need two buttons? Surely you can simply update the icon on the button that simulates your hotkeys...?
I use polling for many things, including Stream Deck button modification, usually using a macro that's triggered once per second. It's good enough for my purposes. KM is very efficient and polling works fine for most purposes. However it would be nice if KM added support for a "quarter second trigger" rather than a minimum of one second.
The most advanced macro I have for the Stream Deck is that I made a button called SWAP, and if I press it, then the next two buttons on the Stream Deck that I press swap their positions. That took a lot of code, but it helps me organize my buttons. In short, I had to add a level of indirection between KM and Stream Deck. Using that macro, I created another macro that randomly rearranges all the buttons on my Stream Deck, which is more entertaining than useful.
I mean that was my original post on here I wanted the same button to press and show the icon. But The First person told me that is not possible. As far as I know of the Keyboard Maestro Plugin can just show things but I have not found a way to make that Plugin a Trigger. It seems only the KM Link Plugin can trigger actions. That's why I did two buttons. One using KM Link to trigger it, and the Keyboard Maestro Plugin to Display it.
But I am a super noob at this stuff, if there is a way to do it, I would love to know. The only way I think it would be possible is if someone wrote a new plugin that had that functionality or they updated the Keyboard Maestro plugin to have the same functionality as the KM Link Plugin.
Peter wasn't referring to whether you could use one button; he meant that the menu item check needs to be triggered by something.
Set your macro to use the USB Device Key Trigger and press your Stream Deck button. That's it.
You should check out the differences between KM Link and the Native KM SD plugin here:
Post your currrent macro with a description of its purpose and I'll see if I can get you up and running with a OneButtonToRuleThemAll solution.
Too many cooks spoil the broth, but I want to add my spin to this discussion.
A "trigger" can be created only if the operating system itself (macOS) calls the KM engine. A simple example is when a keystroke is pressed. MacOS will call KM to inform KM that a keystroke has been pressed. If MacOS didn't do this, KM Engine would have to constantly "poll" to see if a key is pressed, and in general the KM Engine does not poll for anything.
When Peter wrote his post to you, he was indicating that MacOS does not inform applications (like the KM Engine) when the menu item has changed. The KM Engine itself will not perform such polling, (that would slow down the Engine for everybody, but in theory it could do that) but you certainly could poll it if you want. I don't see any problem with polling, as long as you limit how many times per minute you check. I think checking once per second would be a reasonable thing to do, and the KM engine certainly supports that.
I've previously accomplished the kind of thinking you are looking for. I poll for values and put the number that I get back on the Stream Deck button. And that button can still be used to send a trigger to the KM Engine. So yes, it is possible.
Polling should only be considered when all other trigger methods are impossible or impractical. This may well be one of those instances, but it depends on the specifics of what @VicFirth is trying to do.
Thank you so much for the help. I apologize for the misunderstanding. The USB Device trigger would work perfectly except if you want to use that same button to trigger another macro on another Stream Deck Profile or Page using the Keyboard Maestro Plugin on the same key then you get the pop up menu from Keyboard Maestro to pick which action you want. I want to avoid that.
I am using it for Pro Tools which has a lot of on of items and I know that I will encounter that problem when I set up all of my keys.
I don't need to poll the system every min or anything. Like how its set up is fine, I just need to trigger the actions I have set up from the same key.
Button Test.kmmacros (3.7 KB)
Please read the link I posted above.
The key to this is the Virtual Column/Row, which allows Keyboard Maestro to differentiate between mappings on the same physical Stream Deck button.
OMG I get it now! Im sorry its like almost 1:30 AM and I am so tired. I was reading the link but it just wasn't making sense, but it clicked now. Thank you again so much for donating your time to help me.
Absolutely possible—I do this all the time. The important part is that it's up to you need to determine what the relevant boolean state is in the application. (Your question wasn't how to do that, and there's a dozen ways to do that in KM, so I won't elaborate here.)
What you don't want to do is read the (for example) UI element's state once, and then assume that it will be synched to the displayed state on the StreamDeck icon. It will fall out of synch. This is one of many reasons I avoid StreamDeck's boolean button widget.
Use the KM Link plugin, and change the icon dynamically in KM with a conditional (i.e., if/then, switch/case).