I need a trigger that runs a macro when I open the Macbook M1 lid and login. I tried Login and Wake Up trigger, but they do not work (I guess I don’t understand how should they work).
Nevermind. I found it
Could you add some notes about what the difficulty was?
- Was something confusing in the doc? (It should be fixed.)
- Were you looking for the wrong search term? (That term should be mentioned in the doc to make it more findable.)
- How would you explain it to a new user who came to you now with the exact same problem?
Forum answers are still helping people 10 years after they were posted.
The macro I was working on had to switch SoundSource presets by typing the corresponding key command when the system audio output changed.
The first thing I did was add the “The audio output device changes” trigger. However, the problem still existed if the output changed while the MacBook lid was closed. So I needed one more trigger to run the macro when the lid was opened.
I tried the login trigger and the wake trigger (which seemed logical to me), but they turned out to be something else. After that, I found “When the Mac is unlocked”.
As for the manual, it’s not really clear for the person who is totally new for such things. In general. But maybe it’s OK?
Sound Source.kmmacros (5.0 KB)
That's a problem with many manuals, not just Keyboard Maestro. One of the hardest things for engineers to do, especially when writing manual pages, is put themselves into the head of someone who doesn't already know how it all works. Even if they sometimes won't admit (although that's not a problem in this group) they need feedback from fresh eyes if their work is to be most useful.
Just yesterday I was trying to control the brightness of the backlight on my keyboard because I wanted everything dark while I was playing Music, but I wanted to see the controls again when the music stopped. I searched all the KBM doc as well as Apple Support and other places. Everything I found for "brightness" was about the screen and everything for "backlight" was how to control it manually. Finally I found something that used the term "illumination" and searching the KBM Wiki for that term turned up the Simulate_Hardware_Key page. That had my answer.
So in this case, all it will take is to add the terms "brightness" and "backlight" to that page somewhere for that page to turn up in future searches. Which is why I'm inviting you to imagine what might have made it easier for you. If you think of something, great.
The problem is that there is no "when the lid is opened" trigger -- you're inferring that the lid has been opened from another trigger event, and "Unlock" or "Wake" may or may not work depending on your settings and what exactly happens.
A discussion like that is difficult to include in a manual, but exactly what the Forum is for!
Yes, but small examples would help.
For instance:
“Audio Output Changed
The Audio Output Changed trigger (v8+) lets you execute a macro whenever the audio output device changes, typically when you plug headphones in.
The %TriggerValue% token will hold the name of the selected audio output device.“
Would be nice to explain that you could use the trigger value for “If Than Else” and include the example. I understand it could be obvious, but it’s not:-)
%TriggerValue% is just a text token. Like any text token it can be evaluated against one or more Conditions in an "If... Then... Else..." (or "Switch/Case") Action. While I agree that there could be more example on the Actions' pages, or even the "Conditions" pages, putting examples on each page of the 19 trigger-types that have a trigger value seems a waste of effort -- especially given that they'd all be more or less the same!
KM macros are, at their heart, a series of simple evaluations and actions that can be combined in infinite variety -- IMO it's more important to document the fundamentals than each and every possible use of of each and every thing.
I’m intrigued by the term “login”. To me opening the lid leads to an unlock not a login.
But after that I need to type a password and login? I guess ![]()
I think unlock, whether by password, watch, or Touchid.
Well it was not obvious for me.
No.
The KM manual and Wiki are using the correct technical terms for these events. "Login" is when the KM Engine starts up when you initiate your user session by logging into your device, "Unlock" is when you have a user session already active but locked and you unlock it. "Wake" is when you have a user session already active but your machine is asleep and you wake it.
Any of those events may, or may not, require you to enter your password.
The KM documentation does make some assumptions, one of which is that the reader is familiar with English macOS terminology. That may not be correct, particularly when the reader has localised System Settings and so doesn't have clues like "Login Items" and so on.
Unfortunately, even native English speakers often do not understand the distinctions that the technical terms make. Since KBM is strict about their meanings and usages, maybe those meaning should be mentioned in the documentation for clarification and to help educate people of all languages.
There is a Glossary which would be where to put such definitions.