One of the many edge cases I've used KM to solve is my Wacom tablet driver partially losing connection to its OLED button label displays on sleep / wake.
So I have a KM macro that on wake quits the Wacom driver, waits a few seconds, and then relaunches it. Which works splendidly, except...
When the driver relaunches, even though it's not a GUI app and has no windows etc of its own (it lives in a hidden folder etc), focus is lost from the foremost window I'm in. It doesn't appear to go to anything - I'm remaining in the same application, focus is just lost from the current window / what I'm doing.
So if I'm in the middle of typing in iMessage, suddenly the input field isn't receiving keystrokes, and the computer is beeping because I'm issuing meaningless unmodified keyboard commands.
I've tried the Open command with Finder as the operator, and I've tried the Activate command on the driver app directly.
Would the checkboxes for Activate, or the If already at the front: droplist make any difference?
The shifting focus is odd, because it's not going TO something else specifically - the current window, regardless of what app is open, is just de-focussed. My suspicion is it's a symptom of launching something that doesn't have any user-facing UI.
that's not actually the problem - the tablet stays connected, and all its input functions work, it's just the OLED displays (which only this model has) which act as dynamic labels for the buttons which fail to wake.
I'm happy to try the suggestion, I just wasn't sure of the logic of it, because I don't appear to be leaving the foreground application when the macro is run. Its foremost window is deselected, but the active application name in the application menu doesn't change.
What I would expect to happen therefore is something like
Switch to: iMessage start typing
Macro fires off.
Last Application switches me to Safari...
Unless what I'm seeing is some strange state where I'm not actually in iMessage, but the driver has not taken over the menubar, so I'm seeing iMessage's ownership of it while it's a background application.
I'll try it out overnight and see what happens for the next sleep/wake cycle.
Otherwise I imagine I'll have to investigate if there's a way to explicitly launch as a background process?
System woke with Finder as the foremost application.
I switched to Messages, whose sidebar became partially transparent with the desktop background colour, and the cursor began flashing in the text entry field.
The tablets OLED screens all came to life as the driver relaunched.
The Messages window lost focus, sidebar turning opaque and cursor disappearing from text entry field, while Messages remained the named application in the applications menu.
I think I'm going to experiment with setting the driver Quit to a sleep trigger as a separate action, and just launch the driver on Wake so I can avoid the problem, unless there's a known way to launch something in the background that won't steal focus?
Yeah, it looks like they're experiencing something with a similar root cause...
What I suspect is needed is an Activate Last Window action, because even if KM is switching back to the application, it isn't returning focus to a window - so you have to manually click a window, even if it's the only one the application has, to get it into a position where it can receive input.