Finding the Current Front-most Application and Window

Hi,

I'm curious if using Keyboard Maestro, there is a way to check at a particular time (example every hour) - to tell what the front-most application and window title is on the Mac.

For example:

  • at 10 o'clock I am using a particular safari window
  • at 11 o'clock I am using Text Edit
  • at 12 o'clock I am using Apple Mail

etc...

In addition– It would be great to know more in depth particulars of the front most Application at front most window - such as the title of the Safari window or the title of the text edit document or the title of the particular apple mail.

I am curious if this is possible to set up?

Thanks in advance– Dave

Hi @dealtek, this is easy to set up. Look at this:

KM 0 2021-05-18_15-59-21

Set up your macro with a periodic trigger to suit your needs and then the Display Text action will briefly show the name of the frontmost application and its window title.

Test.kmmacros (1.8 KB)

Instead of the Display Text action (which will pop up every hour and may get in the way of what you're doing) you could write the information to a file.

You can find the definition of the KM Tokens used in the Display Text action here:

https://wiki.keyboardmaestro.com/token/Application_Tokens

and

https://wiki.keyboardmaestro.com/token/Window_Tokens

Hope this helps.

4 Likes

Hi tiffle - thanks much - I will check this out.

1 Like

Could something like this be run every time the front window changes?

Yes.

Replace the Periodic trigger with the Focused Window trigger. See the KM wiki trigger:Focused Window [Keyboard Maestro Wiki]

2 Likes