Can KM detect Witch's popup panel (popup window)?

Can Keyboard Maestro detect when Witch (the switcher app from Many Tricks, has been activated and has popped up its switcher panel? I’d like to be able to automatically disable or redefine some hotkey triggers, so they can be seen and used by the new version 4 beta of Witch. But since activating Witch doesn’t change what KM sees as the active application or the front window, I’m not sure how to do this.

Use @ccstone’s “Window Discovery Tool” macro to determine what windows KM can see:

Note that this is not the first post in the thread. The first post has an older version of the macro. The link above will take you to the third post, which contains the current version of the macro.

Thank you! I find that System Events can indeed see a window owned by witchdaemon.

Now my problem is that is inside the Witch prefpane. I can see it by right-clicking and selecting Open Package Contents, but I can’t easily have Keyboard Maestro test directly for it, because KM’s Application condition can’t see it at all: not as a currently running app (because if I bring up the Witch popup and then activate KM, that act dismisses the Witch popup and thus the daemon), not as a recently run app (because it’s a daemon), and not with the built-in file browser (because it can’t open package contents).

So I’ll look for a clever way for KM to determine on the fly whether is running; I bet the script in ccstone’s macro will be a good starting place! though I haven’t looked at it in detail yet. I appreciate your help (and ccstone’s)!

How about if you use a “window with title” condition?

It has no title :frowning:

I downloaded the beta, and I don’t see any way. Perhaps someone else will.

Hey Shoshanna,

You can do something like this when Witch’s window is open:

tell application "System Events"
   tell application process "witchdaemon"
      if (count of windows) = 1 then
         # Do Something!
      end if
   end tell
end tell

You can also complain to the developers that they’ve provided very sketchy accessibility information in the app.


Yes, that script pretty much reflects my plan, though I haven’t had a chance to dig into it in the last few days. (I want some macros to be disabled when Witch is active, and I need to think about the best way to do that.) And I’ve also been in touch with the people behind Witch, so if I’m lucky they’ll offer some easier way to check. Thanks for the sample script and sympathy – and for your wonderful window discovery tool that Dan pointed me to!

And right after I posted that, I got a message from the Witch team that in the next beta, its window will have a name. Huzzah.

1 Like