Google Chrome triggering System Unlock Event on Quit

I have macro which is triggered on System Unlock, but recently I noticed that whenever I quit Chrome (double hit Cmd+Q) or whenever a Selenium Script I have quits Chrome, it runs this macro. When I checked the Engine.log I can see that Keyboard Maestro is detecting an 'Unlock Event' which is triggering my macro.


Here are my macro triggers:

I have restarted my computer a few times but no luck.

I'm running Keyboard Maestro 10.0.2
macOS 12.3.1
Chrome 101.0.4951.54

I'm not sure if this is a Chrome bug, a macOS bug (most likely) or a KM bug, but I thought I would bring it up here in case anyone else has seen this.

Keyboard Maestro considers the system to be locked if the front application is either com.apple.loginwindow or com.apple.SecurityAgent, and considers the system to be unlocked when the front application is none of com.apple.loginwindow or com.apple.SecurityAgent or com.apple.ScreenSaver.Engine.

You can enable debugging in Keyboard Maestro with the command:

defaults write com.stairways.keyboardmaestro.engine Debug Unlock

and restart the Keyboard Maestro engine, and it will tell you which process it sees coming to the front in the Engine.log file.

So my guess is that one of those processes is coming to the front briefly at the time of unlock. I have no idea why that would be. Certainly it does not happen for me when I quit Chrome, so something else is presumably involved.

Thanks. I ran my Selenium process (most reliable way to trigger the issue) and got the following in the logs after enabling the debug statements:

2022-06-28 15:48:26 Engine Quitting
2022-06-28 15:48:32 Debugging level set to ' Unlock '
2022-06-28 15:48:32 Engine Starting 10.1.1
2022-06-28 15:48:32 RegisterTrigger Unlock Trigger 31
2022-06-28 15:48:32 UnregisterTrigger Unlock Trigger 31
2022-06-28 15:48:32 RegisterTrigger Unlock Trigger 73
2022-06-28 15:48:33 UnregisterTrigger Unlock Trigger 73
2022-06-28 15:48:33 RegisterTrigger Unlock Trigger 115
2022-06-28 15:50:20 Became Locked with com.apple.loginwindow
2022-06-28 15:50:21 Became Unlocked with com.apple.Safari
2022-06-28 15:50:21 Fire Unlock Trigger 115
2022-06-28 15:50:21 Execute macro “Morning Coffee” from trigger At System Unlock

Note my Selenium script just goes to my bank website to scrape a bunch of data and then quits Chrome. What's interesting is how the com.apple.loginwindow "locked" things with Safari unlocking immediately after.

Yes, so it seems that the loginwindow is somehow becoming the front process briefly at that point.

I'm not sure how that happens, but I will have to have a think about how to work around that being considered an unlock situation.

1 Like